Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot Connecting database using SSL Certificate

I need to connect to postgresql using SSL Certificate from spring boot application. I have got the certificate and currently i am connecting to db using username and password which i have provided in application.yml file.

Can someone point me to the right tutorial? I could not find anything relevant for spring boot ssl database connection.

like image 481
Jigar Naik Avatar asked Oct 27 '25 05:10

Jigar Naik


1 Answers

you need to append below in URL

&sslmode=verify-full&sslrootcert=/path/to/pemfile

Your URL will look something like

jdbc:postgresql://server:5432/databaseName?currentSchema=dbschema
    &sslmode=verify-full&sslrootcert=/home/certificates/mycert.pem

you can refer below URLs

https://jdbc.postgresql.org/documentation/head/connect.html#ssl

https://docs.amazonaws.cn/en_us/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts.General.SSL

like image 69
Shailesh Chandra Avatar answered Oct 28 '25 19:10

Shailesh Chandra



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!