Skip to content

Sham0511/Library_management_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Book Management System

A Java-based web application for managing books and authors using Servlets and Oracle Database.

πŸ“‹ Overview

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.

✨ Features

  • 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

πŸ› οΈ Technologies Used

  • 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)

πŸ“ Project Structure

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

πŸ—„οΈ Database Schema

Author_tbl

CREATE TABLE Author_tbl (
    Author_code NUMBER(5) PRIMARY KEY,
    Author_name VARCHAR2(20) NOT NULL,
    Contact_no NUMBER(10)
);

Book_tbl

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)
);

Sample Data

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;

πŸš€ Setup Instructions

Prerequisites

  • JDK 11 or higher
  • Apache Tomcat 10.1.x
  • Oracle Database 11g/12c
  • Oracle JDBC Driver (ojdbc8.jar or higher)

Installation Steps

  1. Clone the repository
   git clone https://github.com/yourusername/book-management-system.git
   cd book-management-system
  1. Configure Database
    • Update database credentials in DBUtil.java:
   String url = "jdbc:oracle:thin:@localhost:1521:xe";
   String user = "your_username";
   String pass = "your_password";
  1. Create Database Tables

    • Execute the SQL scripts provided in the Database Schema section
    • Insert sample author data
  2. Add JDBC Driver

    • Place ojdbc8.jar in /WEB-INF/lib/ directory
  3. Deploy to Tomcat

    • Build the project as a WAR file
    • Deploy to Tomcat's webapps directory
    • Start Tomcat server
  4. Access Application

    • Open browser and navigate to: http://localhost:8080/Library Management System/Main.html

πŸ“– Usage

Adding a Book

  1. Click on "ADD BOOK" from the main menu
  2. Fill in the book details:
    • ISBN Number
    • Book Name
    • Book Type (General/Technical)
    • Select Author
    • Book Cost
  3. Click "AddBook" to save

Viewing a Book

  1. Click on "VIEW BOOK" from the main menu
  2. Enter the ISBN code
  3. Click "ViewBook" to display details

βš™οΈ Configuration

Book Type Options

  • G: General
  • T: Technical

Validation Rules

  • 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'

πŸ› Troubleshooting

Common Issues

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

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/YourFeature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin feature/YourFeature)
  5. Open a Pull Request

πŸ“ License

This project is open source and available under the MIT License.

πŸ‘€ Author

Your Name

πŸ™ Acknowledgments

  • Wipro Training Program
  • Java Servlet Documentation
  • Oracle Database Documentation

Note: This is an educational project demonstrating servlet-based web application development with database integration.

OUTPUT: op-2 op-1 op-4 op-3 op-5

About

A java Servlet & JDBC based project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors