AWS BeanStalk 不倾向于连接到 AWS RDS
Posted
技术标签:
【中文标题】AWS BeanStalk 不倾向于连接到 AWS RDS【英文标题】:AWS BeanStalk doesn't tend to connect to AWS RDS 【发布时间】:2018-12-03 13:41:54 【问题描述】:我想我快到了。
我创建了一个 AWS BeanStalk 实例并向其中添加了一个 oracle 数据库实例。
当我找到日志时,我看到驱动程序已加载,但它一直说 URL 是 无效的。
这是我的 RDS 信息和日志消息。
[RDS 信息] 端点 = aa1c9autjaqoufk.c2k1ch01futy.ap-northeast-2.rds.amazonaws.com 端口 = 1521 公共访问 = 是
[系统日志]
25-Jun-2018 02:42:56.759 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
25-Jun-2018 02:42:56.787 INFO [main] org.apache.tomcat.util.net.NioselectorPool.getSharedSelector Using a shared selector for servlet write/read
25-Jun-2018 02:42:56.796 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
25-Jun-2018 02:42:56.799 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
25-Jun-2018 02:42:56.800 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1366 ms
25-Jun-2018 02:42:56.842 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
25-Jun-2018 02:42:56.848 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.50
25-Jun-2018 02:42:56.872 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /var/lib/tomcat8/webapps/ROOT
25-Jun-2018 02:42:58.613 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
25-Jun-2018 02:42:58.689 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /var/lib/tomcat8/webapps/ROOT has finished in 1,817 ms
25-Jun-2018 02:42:58.693 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
25-Jun-2018 02:42:58.720 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
25-Jun-2018 02:42:58.736 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1935 ms
Loading driver...
Driver loaded!
jdbc:oracle:oci://aa1c9autjaqoufk.c2k1ch01futy.ap-northeast-2.rds.amazonaws.com:1521/ebdb?user=username&password=password
SQLException: Invalid Oracle URL specified
SQLState: 99999
VendorError: 17067
Closing the connection.
SQLException: Invalid Oracle URL specified
SQLState: 99999
VendorError: 17067
Closing the connection.
我在我的 Web 项目库中包含了 ojdbc8 drvier 并进行了构建。 这是关于司机的吗?我做错了什么?
【问题讨论】:
【参考方案1】:消息清楚地表明您的 URL 不正确,
应该如下所示。
//step1 load the driver class
Class.forName("oracle.jdbc.driver.OracleDriver");
//step2 create the connection object
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:@aa1c9autjaqoufk.c2k1ch01futy.ap-northeast-2.rds.amazonaws.com:1521:edb","username","password");
`
【讨论】:
您所说的 amazon-rds-urlt 是指端点,对吗?我保证我输入了正确的 URL @KimHyungJune 是的,我的意思是amazon-rds-url
请参阅下面的分步示例。 mkyong.com/jdbc/connect-to-oracle-db-via-jdbc-driver-java以上是关于AWS BeanStalk 不倾向于连接到 AWS RDS的主要内容,如果未能解决你的问题,请参考以下文章
将 AWS Amplify 前端连接到 AWS Elastic Beanstalk 后端时出现 CORS 问题
将 Android 应用程序连接到 AWS Elastic Beanstalk/RDS
Amazon AWS Elastic Beanstalk - 连接到 mongodb
AWS Elastic Beanstalk Worker 无法连接到 SQS