Java PostgreSQL Project Setup with Docker and Maven

github repo

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

  1. Clone the repository:
git clone https://github.com/justin-napolitano/sup-court-postgres-post.git
cd sup-court-postgres-post
  1. Start PostgreSQL and Adminer using Docker Compose:
docker-compose up -d
  1. Verify that PostgreSQL is running on port 5432 and Adminer on port 8080.

  2. Set up the Maven project and dependencies (including PostgreSQL JDBC driver) in pom.xml.

  3. Use the provided SQL files in the sql/ directory to create and manage database tables.

  4. 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
hjkl / arrows Β· / search Β· :family Β· :tag Β· :datefrom Β· :dateto Β· ~/entries/slug Β· Ctrl+N/Ctrl+P for suggestions Β· Ctrl+C/Ctrl+G to cancel
entries 201/201 Β· entry -/-
:readyentries 201/201 Β· entry -/-