A project I built while learning Java Database Connectivity. Implements CRUD, Data Access Object pattern on a postgreSQL database built ontop a docker container.
Clone this repo to your local machine How To Guide
These commands are for linux/Mac, changes will need to made if you are running this in Microsoft Windows.
- Basic Knowledge of JAVA. Great tutorial on Javatpoint.
- Java JDK 8 at least installed on Local machine. Oracle Doc for Mac & Windows.
- An IDE installed in local machine. Used intelliJ IDEA.
- Docker is installed Download.
- psql client is installed Postgres/psql.
-
Pull Docker Image
docker pull postgres
-
Build data directory
mkdir -p ~/srv/postgres
-
Run docker image
docker run --rm --name lil-postgres -e POSTGRES_PASSWORD=password -d -v $HOME/srv/postgres:/var/lib/postgresql/data -p 5432:5432 postgres
docker stop lil-postgres
psql -h localhost -U postgres -d hplussport
psql -h localhost -U postgres -f database.sql
psql -h localhost -U postgres -d hplussport -f customer.sql
psql -h localhost -U postgres -d hplussport -f product.sql
psql -h localhost -U postgres -d hplussport -f salesperson.sql
psql -h localhost -U postgres -d hplussport -f orders.sql
After setting up development environment, docker container
- Build & Run
- Can also run SQL commands on terminal after logging in.
You should comprehensive outputs in the terminal....Hurray you have a functional database.
- Divine Odazie