简体   繁体   English

在Idea Intellij上,如何连接到Google Cloud SQL

[英]On Idea Intellij, how to connect to Google Cloud SQL

I try to use the Intellij for develop an Google App Engine application with Google Cloud SQL. 我尝试使用Intellij开发使用Google Cloud SQL的Google App Engine应用程序。 How to configure the Cloud Sql access in the developpement launch ? 如何在开发阶段启动中配置Cloud Sql访问?

I add this in the VM options : 我在VM选项中添加了这个:

-Drdbms.server=hosted -Drdbms.hosted.instance=my-sql-project-id:test
-Drdbms.database=database -Drdbms.driver=com.google.cloud.sql.jdbc.Driver

But the Google Sql must be connected to the server via the oauth2 token. 但是Google Sql必须通过oauth2令牌连接到服务器。

With the Eclipse Google Plugin, the plugin connect to the database and automatically configure the connection. 使用Eclipse Google插件,插件可以连接到数据库并自动配置连接。

Thanks, 谢谢,

The recommended way currently to connect from dev_appserver to Cloud SQL is using the external IP connectivity. 目前从dev_appserver连接到Cloud SQL的推荐方法是使用外部IP连接。

Reference: https://cloud.google.com/sql/docs/access-control#appaccess 参考: https//cloud.google.com/sql/docs/access-control#appaccess

On the Google Developer Console, click on your Cloud SQL instance and then click on 'How to connect to your Cloud SQL instance'. 在Google Developer Console上,单击您的Cloud SQL实例,然后单击“如何连接到您的Cloud SQL实例”。 A window will pop up with instructions for Python, Java and PHP. 将弹出一个窗口,其中包含Python,Java和PHP的说明。 There will be a code snippet that shows you how to connect to your Cloud SQL instance using Java. 将有一个代码片段,向您展示如何使用Java连接到您的Cloud SQL实例。 In order to connect from App Engine, you will need to update your appengine-web.xml file as instructed in the documentation: https://cloud.google.com/appengine/docs/java/cloud-sql/#enable_connector_j 要从App Engine进行连接,您需要按照文档中的说明更新appengine-web.xml文件: https//cloud.google.com/appengine/docs/java/cloud-sql/#enable_connector_j

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

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