简体   繁体   English

Spring 使用 SSL 证书启动连接数据库

[英]Spring Boot Connecting database using SSL Certificate

I need to connect to postgresql using SSL Certificate from spring boot application.我需要使用来自 spring 引导应用程序的 SSL 证书连接到 postgresql。 I have got the certificate and currently i am connecting to db using username and password which i have provided in application.yml file.我已经获得了证书,目前我正在使用我在 application.yml 文件中提供的用户名和密码连接到 db。

Can someone point me to the right tutorial?有人可以指出我正确的教程吗? I could not find anything relevant for spring boot ssl database connection.我找不到与 spring 启动 ssl 数据库连接相关的任何内容。

you need to append below in URL你需要在 URL 下面的 append

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

Your URL will look something like你的 URL 看起来像

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://jdbc.postgresql.org/documentation/head/connect.html#ssl

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用JPA / Hibernate将Spring Boot连接到PostgreSql数据库时失败 - Failure while connecting Spring Boot to PostgreSql database using JPA/Hibernate 无法使用Spring Boot连接到PostgreSQL数据库来添加和更新值 - Can't add and update values using Spring Boot connecting to PostgreSQL database 如何使用SSL和Spring Boot连接到PostgresQL? - How to connect to PostgresQL using SSL and Spring Boot? 连接时从 Spring 引导项目到 PostgreSQL 数据库的连接问题 - Connection issue from Spring Boot projects to PostgreSQL database while connecting 运行时连接多个数据库并选择表 spring 启动 java - Connecting to multiple database and selecting tables at runtime spring boot java 将 Spring 引导连接到 PostgreSQL 失败 - Connecting Spring Boot to PostgreSQL fails Spring Boot 使用 SSL 连接到 Postgresql - Spring Boot connection to Postgresql with SSL 从Spring Boot应用程序连接数据库时org.postgresql.util.PSQLException - org.postgresql.util.PSQLException while connecting database from spring boot application Dataproc:未找到连接到外部 PostgreSQL 的 Sqoop 作业的 SSL 证书 - Dataproc: SSL certificate not found for Sqoop job connecting to external PostgreSQL 从 Spring Boot 连接到 Heroku Postgres - Connecting to Heroku Postgres from Spring Boot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM