使用 Spring 启动连接到 AWS Aurora Serverless

Connecting to AWS Aurora Serverless with Spring Boot

正在尝试将 Spring 引导容器连接到 Aurora Serverless 数据库。这是有效的:

但是,当我为无服务器数据库配置数据库连接参数并启动容器时,出现以下错误:

    org.postgresql.util.PSQLException: The connection attempt failed.
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:315) ~[postgresql-42.2.16.jar!/:42.2.16]
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[postgresql-42.2.16.jar!/:42.2.16]
    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:225) ~[postgresql-42.2.16.jar!/:42.2.16]
    at org.postgresql.Driver.makeConnection(Driver.java:465) ~[postgresql-42.2.16.jar!/:42.2.16]
    at org.postgresql.Driver.connect(Driver.java:264) ~[postgresql-42.2.16.jar!/:42.2.16]
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.4.5.jar!/:na]
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358) ~[HikariCP-3.4.5.jar!/:na]
    ...
    Caused by: java.io.EOFException: null
    at org.postgresql.core.PGStream.receiveChar(PGStream.java:443) ~[postgresql-42.2.16.jar!/:42.2.16]
    at org.postgresql.core.v3.ConnectionFactoryImpl.enableGSSEncrypted(ConnectionFactoryImpl.java:436) ~[postgresql-42.2.16.jar!/:42.2.16]
    at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:144) ~[postgresql-42.2.16.jar!/:42.2.16]
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213) ~[postgresql-42.2.16.jar!/:42.2.16]
    ... 37 common frames omitted

这是我尝试过的(根据 this post):

    spring.datasource.hikari.minimum-idle=0
    spring.datasource.hikari.maximum-pool-size=10
    spring.datasource.hikari.connection-timeout=60000
    spring.datasource.hikari.max-lifetime=90000
    spring.datasource.hikari.idle-timeout=90000
    spring.main.lazy-initialization=true

我的计算机是对等 VPC 中的工作区,因此 VPC 应该不是问题。此外,当我在 VPC 内的 ECS 集群中启动容器时,我遇到了同样的问题。任何帮助将不胜感激 - 我已经研究了数周。

我成功地将 ?gssEncMode=disable 添加到 jdbc url。

例如:jdbc:postgresql://dev-aurora-postgres-serverless.cluster-xxxxxxx.eu-central-1.rds.amazonaws.com:5432/my_db?gssEncMode=disable