Using Google Cloud SQL during Java appengine development (instead of local MySQL instance)

南楼画角 提交于 2019-12-19 10:18:24

问题


Instead of using a local MySQL instance during Java appengine development, i (sometimes) want to use a real Google Cloud SQL instance (for example; to debug with the real thing).

It is possible to open a JDBC connection from IntelliJ => Databases, but when i'm using this URL in my Maven POM its not working... In this situation i'm already using the appengine driver instead of the local mysql connector.

Why isn't this working? How should i configure my POM? I'm using the following configuration when using the local MySQL instance;

<extraJvmArgs>
 -Xmx512M -Xms512M -XX:MaxPermSize=128M \
 -Dappengine.user.timezone.impl=UTC \
 -Drdbms.server=local \
 -Drdbms.driver=com.mysql.jdbc.Driver \
 -Drdbms.url=jdbc:mysql://localhost:3306/mydb?user=root
</extraJvmArgs>

And my non working Google Cloud SQL instance attempts;

<extraJvmArgs>
 -Xmx512M -Xms512M -XX:MaxPermSize=128M \
 -Dappengine.user.timezone.impl=UTC \
 -Drdbms.server=local \
 -Drdbms.driver=com.mysql.jdbc.Driver \
 -Drdbms.url=jdbc:google:rdbms://domain.com:myportal:myportal/mydb?user=root
</extraJvmArgs>

or

<extraJvmArgs>
 -Xmx512M -Xms512M -XX:MaxPermSize=128M \
 -Dappengine.user.timezone.impl=UTC \
 -Drdbms.server=local \
 -Drdbms.driver=com.google.appengine.api.rdbms.dev.LocalRdbmsServiceLocalDriver \
 -Drdbms.url=jdbc:google:rdbms://domain.com:myportal:myportal/mydb?user=root
</extraJvmArgs>

All my (remote) attempts result in a connection timeout...


回答1:


The 'jdbc:google:rdbms' way to connect is deprecated and the preferred way to connect to Cloud SQL from an external application is to use the IP connectivity via the 'jdbc:mysql' (docs).



来源:https://stackoverflow.com/questions/20869422/using-google-cloud-sql-during-java-appengine-development-instead-of-local-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!