我正在构建本地 Spring 应用程序以访问我在 OpenShift 上创建的数据库,地址为 127.2.xx.yy/eetom:3306
。所以我在 Beans.xml
中创建了这个属性。
<property name="url" value="jdbc:mysql://127.2.xx.yy:3306/eetom"/>
但我遇到了异常(exception)情况,例如
Could not get JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
和
The driver has not received any packets from the server
所以我将 ip 更改为 localhost
并使用 OpenShift rhc 创建端口转发。而rhc
显示我原来放的ip和端口就是用来做端口转发的。那个方法奏效了。
问题:
在没有端口转发的情况下直接访问mysql的正确方法是什么?
最佳答案
之前有人帮助过我,它来自 OpenShift:OpenShift 不支持直接连接到不可扩展应用程序上的嵌入式数据库。
关于java - 本地Spring应用如何访问OpenShift上的mysql?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19716499/