简体   繁体   中英

Eclipse Spring Boot Project Not Connecting to AWS Database

I have a project where we are connecting to an AWS database to run a spring boot starter project (java, html, and css are used). I have no compiling errors in the program, but when I run the program to work through the code, the spring boot program is terminated without running successfully. I have tried looking at several different aspects of my code but I am unable to find any issues. I have tomcat installed as well. Any help or feedback would be appreciated. I have attached the application properties below for my spring boot program. please let me know if anything else could be useful.

application.properties


##spring.datasource.url=jdbc:mysql://cis175group.c3yjnhalr3i9.us-east-1.rds.amazonaws.com/petreg?useSSL=false
spring.datasource.url=jdbc:mysql://localhost:3306/petreg?useSSL=false
##spring.datasource.username=admin
##spring.datasource.password=airplanecar
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

spring.datasource.username=root
spring.datasource.password=password
spring.jpa.database-platform = org.hibernate.dialect.MySQL8Dialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto = update

# ==============================================================
# = Show or not log for each sql query
# ==============================================================
spring.jpa.show-sql = true 
spring.jpa.properties.hibernate.format_sql = true ```

Since you have not provided the error you are getting while running your application, it's difficult to pin-point exact issue. But I will first verify if AWS DB (MySQL) is publicly accessible or not. Try connecting your DB instance from, say, MySQL workbench to check if you are able to connect to it. If not, it's most probably because your AWS DB is not publicly available. You have to make it accessible outside AWS by changing this setting in AWS console:

在此处输入图像描述

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