提问者:小点点

Spring启动无法连接到我的postgresql aws rds数据库


我已经配置了我的spring boot 3.0.5应用程序来访问我的数据库aws rds,但是我有一个连接错误。我的数据库有私人访问,我使用一个ssh连接和ec2实例来访问我的数据库和pgadmin。

我的应用程序属性配置

spring.datasource.url=jdbc:postgresql://endpoindofmydatabase:5432/db_name
spring.datasource.username=user_name
spring.datasource.password=user_password
#information jpa
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL81Dialect

server.port=9090

我犯的错误

org.postgresql.util.PSQLException: La tentative de connexion a échoué.
    ...
Caused by: java.net.SocketTimeoutException: Connect timed out
...

我验证了凭据,但我没有看到任何问题。


共1个答案

匿名用户

尝试将数据添加到测试的环境变量中...

在此处输入图片描述