Skip to content

DivyaMadane/Bookstore-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bookstore Management System (Java Console App)

This is a simple console-based Bookstore Management System built using Java. It uses JDBC to connect to an H2 database and perform basic CRUD (Create, Read, Update, Delete) operations on a books table.

Features

  • Add new books with name and price
  • View all books
  • Search for a book by ID
  • Search for books by name (partial match)
  • Update a book’s price by its name
  • Delete a book by ID

Technologies Used

  • Java (JDK 8+)
  • JDBC (Java Database Connectivity)
  • H2 Database (Embedded)
  • IntelliJ IDEA (for development)
  • Maven (for dependency management)

Project Structure

pom.xml – Maven configuration file

src/main/java/bookstore/

DAO/

BookDAO.java – Interface defining book operations

BookDAOImpl.java – Implementation of the DAO interface

model/

Book.java – Book entity/model class

runner/

TestBookStore.java – Main class to run and test the application

util/

DBUtil.java – Utility class to manage the H2 database connection

How to Run

  1. Clone the repository: git clone https://github.com/DivyaMadane/Bookstore-java.git

  2. Open the project in IntelliJ IDEA (or any IDE that supports Maven).

  3. Run the TestBookStore class from: src/main/java/bookstore/runner/TestBookStore.java

  4. Use the console menu to perform operations like inserting, viewing, updating, or deleting books.

Database Configuration

The application uses H2 database. No setup is required. A connection is automatically established using:

DriverManager.getConnection("jdbc:h2:~/Desktop/h2", "sa", "");
You can change the path in DBUtil.java if needed.

CREATE TABLE books (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(255),
  price FLOAT
);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages