在Java appengine开发期间使用Google Cloud SQL(而不是本地MySQL实例) [英] Using Google Cloud SQL during Java appengine development (instead of local MySQL instance)

查看:144
本文介绍了在Java appengine开发期间使用Google Cloud SQL(而不是本地MySQL实例)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java appengine开发期间,我(有时)想要使用真正的Google Cloud SQL实例(例如,使用真实的东西进行调试),而不是使用本地MySQL实例。

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).

可以从IntelliJ =>数据库打开JDBC连接,但是当我在我的Maven POM中使用此URL时它无法工作......在这种情况下我已经在使用appengine驱动程序而不是本地的mysql连接器。

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.

为什么这不起作用?我应该如何配置我的POM?我在使用本地MySQL实例时使用以下配置;

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>

我的非工作Google Cloud SQL实例尝试;

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>

<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...

推荐答案

不推荐使用'jdbc:google:rdbms'连接方式,从外部应用程序连接到Cloud SQL的首选方法是使用IP连接通过'jdbc:mysql'( docs )。

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).

这篇关于在Java appengine开发期间使用Google Cloud SQL(而不是本地MySQL实例)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆