spookisukii
spookisukii

Reputation: 13

Failed to connect MySQL RDS instance with Springboot application to create .jar file

I have created an RDS instance of the database that I want to connect with my springboot application. The "Publicly accessible" option is set to "Yes" and I've also added inbound and outbound rules for all IPs to access the database. But I'm getting errors when I run mvn install.

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

Here is the application.properties file:

# datasource configuration
spring.datasource.url=jdbc:mysql://database-1.cem1nmqwwcw4.ap-northeast-1.rds.amazonaws.com:3306/twtappdb?allowPublicKeyRetrieval=true&&useSSL=false
spring.datasource.username=root
spring.datasource.password=Pass#1234
# port customization
server.port=5000

#Hibernate properties
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect

spring.jpa.hibernate.ddl-auto=update

I also tried to connect to the database from MySQL workbench which is showing the error as:

error

Here are the inbound and outbound rules:

inbound rules

outbound rules

Am I doing something wrong in adding the security group rules?

rds security groups

Upvotes: 1

Views: 664

Answers (1)

smac2020
smac2020

Reputation: 10734

If you configure your inbound rules correctly, you can connect from MySQL Workbench to an Amazon RDS instance. I have a MySQL instance running.

Login with Workbench:

enter image description here

Be sure to correctly specify the hostname of the RDS instance, the user name and password.

Once you make sure inbound rules are properly setup, and you specify the correct values in MySQL Workbench, you can connect and query your data.

enter image description here

I do not know what else can be different from what you are doign and what I have done to successfully connect.

Upvotes: 0

Related Questions