A Java project focused on setting up and interacting with a PostgreSQL database using Docker and Maven. This repository serves as a learning exercise for integrating Java applications with PostgreSQL databases and managing database schemas through SQL scripts.
Features
- PostgreSQL database setup using Docker and Docker Compose
- Adminer web-based database management tool included
- Maven project structure for Java development
- SQL scripts for defining database tables
Tech Stack
- Java
- Maven
- PostgreSQL
- Docker & Docker Compose
- Adminer (database management tool)
Getting Started
Prerequisites
- Java Development Kit (JDK) installed
- Maven installed
- Docker and Docker Compose installed
Installation and Setup
- Clone the repository:
git clone https://github.com/justin-napolitano/sup-court-postgres-post.git
cd sup-court-postgres-post
- Start PostgreSQL and Adminer using Docker Compose:
docker-compose up -d
-
Verify that PostgreSQL is running on port 5432 and Adminer on port 8080.
-
Set up the Maven project and dependencies (including PostgreSQL JDBC driver) in
pom.xml. -
Use the provided SQL files in the
sql/directory to create and manage database tables. -
Build and run the Java application using Maven:
mvn clean install
mvn exec:java -Dexec.mainClass="com.createdb.Main"
Project Structure
my-java-project/
βββ src/
β βββ main/
β βββ java/
β βββ com/
β βββ createdb/
β βββ DatabaseClient.java # Handles database connections and queries
β βββ Main.java # Entry point for the Java application
βββ sql/ # SQL scripts to define tables
β βββ CallNumbers.sql
β βββ Contributors.sql
β βββ Items.sql
β βββ Resources.sql
β βββ Subjects.sql
βββ pom.xml # Maven project descriptor
βββ docker-compose.yml # Docker Compose file for PostgreSQL and Adminer
βββ index.md # Project notes and setup instructions
Future Work / Roadmap
- Implement automated workflows for data ingestion and processing
- Expand Java application functionality to support analysis and reporting
- Integrate additional data sources and improve database schema
- Add unit and integration tests for database interactions
- Explore performance optimizations for large-scale data handling
- Provide detailed documentation and usage examples