On Idea Intellij, how to connect to Google Cloud SQL
Asked Answered
B

2

7

I try to use the Intellij for develop an Google App Engine application with Google Cloud SQL. How to configure the Cloud Sql access in the developpement launch ?

I add this in the VM options :

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

With the Eclipse Google Plugin, the plugin connect to the database and automatically configure the connection.

Thanks,

Blodgett answered 5/12, 2014 at 10:24 Comment(0)
E
1

The recommended way currently to connect from dev_appserver to Cloud SQL is using the external IP connectivity.

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

Exoergic answered 7/12, 2014 at 0:48 Comment(0)
L
1

On the Google Developer Console, click on your Cloud SQL instance and then click on 'How to connect to your Cloud SQL instance'. A window will pop up with instructions for Python, Java and PHP. There will be a code snippet that shows you how to connect to your Cloud SQL instance using Java. 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

Luthanen answered 15/12, 2014 at 1:17 Comment(3)
I allready enabled the connector for java in the appengine-web.xml, and my deployed application with Cloud SQL works fine. My question is How to connect to Cloud SQL with the developement server. Last with eclipse, we can connect to the cloud sql by adding -D java configuration, and connect without change our source code. But now, we must add a condition to execute specific developement code and use the external IPv4 connectivity (have a cost and must allow you network).Blodgett
Did you try to use localhost instead of Cloud SQL instance IP address? Though, you have to install MySQL on your computer as it is not coming with SDK. You may also take a look at this link. Sounds it is an obsolete feature: code.google.com/p/googleappengine/issues/detail?id=9733Luthanen
I want to connect to the Cloud SQL instance and not a local mysql. Before, we can with eclipse connect to the Cloud SQL instance. But now as Razvan say, the only way is by using the external IP.Blodgett

© 2022 - 2024 — McMap. All rights reserved.