简体   繁体   English

Eclipse Spring 引导项目未连接到 AWS 数据库

[英]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).我有一个项目,我们正在连接到 AWS 数据库以运行 spring 引导启动项目(使用 java、html 和 css)。 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.我在程序中没有编译错误,但是当我运行程序运行代码时,spring 引导程序在没有成功运行的情况下终止。 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.我也安装了 tomcat 。 Any help or feedback would be appreciated.任何帮助或反馈将不胜感激。 I have attached the application properties below for my spring boot program.我为我的 spring 引导程序附加了以下应用程序属性。 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.但我将首先验证 AWS DB (MySQL) 是否可公开访问。 Try connecting your DB instance from, say, MySQL workbench to check if you are able to connect to it.尝试从 MySQL 工作台连接您的数据库实例,以检查您是否能够连接到它。 If not, it's most probably because your AWS DB is not publicly available.如果不是,很可能是因为您的 AWS 数据库不公开。 You have to make it accessible outside AWS by changing this setting in AWS console:您必须通过在 AWS 控制台中更改此设置使其在 AWS 外部可访问:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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