Skip to content

A Java-based CRUD application to manage employee data using PostgreSQL and JDBC. This project supports operations like βž• adding, πŸ“– retrieving, ✏️ updating, and ❌ deleting employee records. Built with Maven for dependency management and modularity.

License

Notifications You must be signed in to change notification settings

Adil-Bikiev/Employee-Database-Management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Employee Database Management System

This is a simple Java application that interacts with a relational database to manage employee data. It uses JDBC to perform CRUD (Create, Read, Update, Delete) operations on an employee table in the employee_db database. The application consists of an Employee entity class and an EmployeeData class for handling database operations.


Features

  • Create: Add new employees to the database.
  • Read: Fetch details of a specific employee or list all employees.
  • Update: Modify details of an existing employee.
  • Delete: Remove an employee from the database.

Requirements

  • Java Development Kit (JDK): 8 or higher.
  • Apache Maven: For dependency management.
  • PostgreSQL Database: As the relational database system.
  • PostgreSQL JDBC Driver: Added as a Maven dependency.

Database Setup

  1. Install and start PostgreSQL Server.
  2. Open a PostgreSQL client (e.g., pgAdmin or terminal).
  3. Create the employee_db database:
    CREATE DATABASE employee_db;
  4. Connect to the employee_db database:
    \c employee_db
  5. Create the employee table:
    CREATE TABLE employee (
        id SERIAL PRIMARY KEY,
        name VARCHAR(100) NOT NULL,
        position VARCHAR(100) NOT NULL,
        salary DOUBLE PRECISION NOT NULL,
        hire_date DATE NOT NULL
    );

How to Run the Program

Step 1: Clone the Repository

Clone the project repository from GitHub:

git clone https://github.com/your-username/employee-management-system.git
cd employee-management-system

Step 2: Build the Project

Use Maven to build the project:

mvn clean install

Step 3: Configure Database Connection

Update the database connection details in the EmployeeData class:

private static final String URL = "jdbc:postgresql://localhost:5432/employee_db";
private static final String USER = "postgres"; // Replace with your PostgreSQL username
private static final String PASSWORD = "yourpassword"; // Replace with your PostgreSQL password

Sample Operations

Create an Employee

The application will insert a new employee into the employee table.

Database State:

INSERT INTO employee (name, position, salary, hire_date)
VALUES ('Student AlaToo', 'HR Manager', 60000, '2023-01-15');
SELECT * FROM employee WHERE id = 1;
UPDATE employee
SET salary = 65000
WHERE id = 1;
DELETE FROM employee WHERE id = 1;

Screenshot Description

Screenshot Description

Screenshot Description

Screenshot Description


Project Structure

employee-database-management-system
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ main
β”‚   β”‚   β”œβ”€β”€ java
β”‚   β”‚   β”‚   └── com.example
β”‚   β”‚   β”‚       β”œβ”€β”€ App.java          # Main application
β”‚   β”‚   β”‚       β”œβ”€β”€ Employee.java     # Employee entity class
β”‚   β”‚   β”‚       └── EmployeeData.java # Database operations class
β”‚   └── test
β”‚       └── java
β”‚           └── com.example
β”‚               └── AppTest.java      # Unit tests (optional)
└── pom.xml                           # Maven configuration

About

A Java-based CRUD application to manage employee data using PostgreSQL and JDBC. This project supports operations like βž• adding, πŸ“– retrieving, ✏️ updating, and ❌ deleting employee records. Built with Maven for dependency management and modularity.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages