简体   繁体   中英

Communications link failure connecting spring boot app to aws aurora

I am trying to connect the spring boot application I have created locally to an aws serverless aurora database.

I have added the maven dependency:

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.18</version>
    </dependency>

As well as created an application.properties file:

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://myawsclusterlink:3306/mycluster
spring.datasource.username=myusername
spring.datasource.password=mypassword
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

I have also created a VPC inbounds group for the db to allow incoming traffic from my IP address.

My Issue is that that when I run the app, my connection keeps failing with an error message:

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

I would like to know where is the problem. Is my url wrong? Have I not enabled something on aws? Is there something missing in my code?

Also, I don't really know how to test and see where the problem is coming from in this case.

从无服务器更改为预配置的 Aurora 并启用公共访问解决了该问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM