This part will guide you how to install Postgres DB on you local computer.
If you already installed it, check that you know it's username, password, port, DB name. and skip to IntelliJ installation
- Download docker from docker website
- After that initialize Postgres official image
docker run -d --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 postgres- Now your done and the server is running in the background connection creds are
username: postgres
password: mysecretpassword
jdbc-url: jdbc:postgresql://localhost:5432/
- Download Postgres binaries for your OS from postgres download
- run the installer with the default setting (keep the installation directory)
- you will be prompt to set port and password please remember what you chosen
- when finish it might ask to install the stack builder, it is recommend but not a must
- run
pgAdmin4that you have installed - You'll be prompt to put the password from the installation
- if you follow the guide you will create ned db named NewDB
- you r creds will be this
if you changed some thing during insolation
username: postgres
password: ${password from the installation}
jdbc-url: jdbc:postgresql://localhost:${port from the installation}/${DB you created}
else
username: postgres
password: ${password from the installation}
jdbc-url: jdbc:postgresql://localhost:5432/
We recommend using the ultimate version that is free for 30-day trial and for students and educator are free using github pro for students.
- extract the zip to a comfortable place
- open the the extracted folder with IntelliJ
- It might prompt you to download JDK17.
- Sync all of maven packages
- In the project explorer (usually on the left side) in navigate to
src->main->resourcesand openapplication.propertieshere we change our database creds
spring.datasource.username=${Your Postgres username}
spring.datasource.password=${Your Postgres password}
spring.datasource.url=${Your Postgres jdbc link}
-
two ways to run:
-
run the server navigate to
src->main->javaopenDemo1Applicationand run the main function. -
Run in the root folder of the project
Linux/Mac
./mvnw spring-boot:runWindows
mvnw.cmd spring-boot:run
If you have multiple JDK installed so to spesify the currect one use
set JAVA_HOME=${JAVA 17 correto dir}befor running this commands -
After running the backend server once all the tables will be created.
Under the tableFiller folder you will have multiple sql scripts that populate the db with data. see video to how to run them inside the IntelliJ