Skip to content

ilyhus001/COMP3005-Assignment-3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

COMP3005-Assignment-3

PostgreSQL JDBC Connection

This Java program establishes a connection with a PostgreSQL database and demonstrates basic CRUD (Create, Read, Update, Delete) operations on a table named students.

Prerequisites

-PostgreSQL database installed on your local machine. -JDBC driver for PostgreSQL.

Setup

  • Make sure you have a PostgreSQL database running.
  • Replace the connection URL, username, and password in the PostgreSQLJDBCConnection class with your database credentials.
  • Edit these constant values before running. -- private static final String url = "jdbc:postgresql://localhost:5432/Assignment3"; -- private static final String user = "postgres"; -- private static final String password = "your_password";

Usage

Compile the PostgreSQLJDBCConnection.java file.

Copy code:

  • javac PostgreSQLJDBCConnection.java
  • java PostgreSQLJDBCConnection

Operations

-The program demonstrates the following operations:

Add a Student: Inserts a new student into the students table. Update Student Email: Updates the email of a student based on their ID. Delete Student: Deletes a student from the database based on their ID. Get All Students: Retrieves and prints details of all students from the students table.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages