A Java-based web application for managing books and authors using Servlets and Oracle Database.
This Book Management System allows users to add and view book details along with author information. It demonstrates the use of Java Servlets, JDBC, and DAO design pattern for database operations.
- Add Books: Add new books with ISBN, title, type (General/Technical), author, and cost
- View Books: Search and display book details by ISBN
- Author Management: Maintain author information with contact details
- Input Validation: Validates book data before insertion
- Database Integration: Uses Oracle Database for persistent storage
- Backend: Java Servlets (Jakarta EE)
- Database: Oracle Database 11g/12c
- JDBC: Oracle JDBC Driver
- Server: Apache Tomcat 10.1.x
- Frontend: HTML5
- Design Pattern: DAO (Data Access Object)
src/
βββ com.wipro.book.bean/
β βββ AuthorBean.java # Author entity
β βββ BookBean.java # Book entity
βββ com.wipro.book.dao/
β βββ AuthorDAO.java # Author data access operations
β βββ BookDAO.java # Book data access operations
βββ com.wipro.book.service/
β βββ Administrator.java # Business logic layer
βββ com.wipro.book.servlet/
β βββ MainServlet.java # Handles add/view operations
β βββ ViewServlet.java # Displays book details
βββ com.wipro.book.util/
βββ DBUtil.java # Database connection utility
webapp/
βββ AddBook.html # Add book form
βββ ViewBook.html # Search book form
βββ Index.html # Main menu
βββ Invalid.html # Invalid input page
βββ Failure.html # Operation failure page
CREATE TABLE Author_tbl (
Author_code NUMBER(5) PRIMARY KEY,
Author_name VARCHAR2(20) NOT NULL,
Contact_no NUMBER(10)
);CREATE TABLE Book_tbl (
ISBN VARCHAR2(10) PRIMARY KEY,
BOOK_TITLE VARCHAR2(20) NOT NULL,
BOOK_TYPE CHAR(1),
AUTHOR_CODE NUMBER(5),
BOOK_COST NUMBER(8,2),
CONSTRAINT fk_author FOREIGN KEY (AUTHOR_CODE) REFERENCES Author_tbl(Author_code)
);INSERT INTO Author_tbl VALUES (1, 'ROBINSharma', 8800799224);
INSERT INTO Author_tbl VALUES (2, 'R.K.Narayan', 9971935000);
INSERT INTO Author_tbl VALUES (3, 'Paulo coleho', 9876543212);
COMMIT;- JDK 11 or higher
- Apache Tomcat 10.1.x
- Oracle Database 11g/12c
- Oracle JDBC Driver (ojdbc8.jar or higher)
- Clone the repository
git clone https://github.com/yourusername/book-management-system.git
cd book-management-system- Configure Database
- Update database credentials in
DBUtil.java:
- Update database credentials in
String url = "jdbc:oracle:thin:@localhost:1521:xe";
String user = "your_username";
String pass = "your_password";-
Create Database Tables
- Execute the SQL scripts provided in the Database Schema section
- Insert sample author data
-
Add JDBC Driver
- Place
ojdbc8.jarin/WEB-INF/lib/directory
- Place
-
Deploy to Tomcat
- Build the project as a WAR file
- Deploy to Tomcat's
webappsdirectory - Start Tomcat server
-
Access Application
- Open browser and navigate to:
http://localhost:8080/Library Management System/Main.html
- Open browser and navigate to:
- Click on "ADD BOOK" from the main menu
- Fill in the book details:
- ISBN Number
- Book Name
- Book Type (General/Technical)
- Select Author
- Book Cost
- Click "AddBook" to save
- Click on "VIEW BOOK" from the main menu
- Enter the ISBN code
- Click "ViewBook" to display details
- G: General
- T: Technical
- All fields are mandatory
- Book cost must be positive
- ISBN must be unique
- Author must exist in the database
- Book type must be either 'G' or 'T'
1. ORA-01438: value larger than specified precision
- Ensure book cost doesn't exceed 999,999.99
- Solution: Modify column size or enter smaller values
2. Author not found
- Verify author name matches exactly with database (case-sensitive)
- Check for extra spaces in author names
3. Database connection failed
- Verify Oracle service is running
- Check database credentials in
DBUtil.java - Ensure JDBC driver is in classpath
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/YourFeature) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/YourFeature) - Open a Pull Request
This project is open source and available under the MIT License.
Your Name
- GitHub: @Sham0511
- Wipro Training Program
- Java Servlet Documentation
- Oracle Database Documentation
Note: This is an educational project demonstrating servlet-based web application development with database integration.




