How to connect PostgreSQL in Gradle Project

Viewed 14377

I am trying to connect PostgreSQL in gradle project. I have a requirement to make CRUD operations. CAN SOME HELP ME. Thanks in Advance

1 Answers

Add PostgreSQL dependency in build.gradle

runtimeOnly 'org.postgresql:postgresql'

then, add the properties in application.properties

spring.datasource.url= jdbc:postgresql://localhost:5432/sample
spring.datasource.jdbc-url=${spring.datasource.url}
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.platform=postgres
spring.datasource.username=postgres
spring.datasource.password=password

then, Implement you JPA, jdbctemplate,.. in your code.

Related