Reputation: 302
I am using Java 8, so as to connect with Google Cloud SQL from Google Standard App Engine. Tried sample available at below link too so as to test connection https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/cloud-sql/mysql/servlet
Issues I am facing:
I have following components available at my Google cloud:
Thanks
Upvotes: 0
Views: 693
Reputation: 6290
As described in the official doc, you have 2 alternatives to connect to Cloud SQL from App Engine Standard environment :
Cloud SQL in public IP = use Cloud SQL Proxy with INSTANCE_CONNECTION_NAME
Cloud SQL in private IP = Connect using your instance's private IP and port 3306, via Servless VPC configuration.
It means in your case, if your Cloud SQL instance has only private IP, you have to connect to it directly via Serverless VPC.
Note that your App Engine standard application need a correct setup to be able to send traffic via Serverless VPC connector, with at least these 2 main points :
Serverless VPC Access connector need to be in the same project and region than the GAE application which uses it.
GAE app needs to be configured with VPC connector in the appengine-web.xml
file for Java8
runtime as below:
<vpc-access-connector>
<name>projects/PROJECT_ID/locations/REGION/connectors/CONNECTOR_NAME</name>
</vpc-access-connector>
More details on how to configure Serverless VPC connector with GAE standard Java8 runtime.
Upvotes: 1