1

I have written a java servlet in app engine that i am trying to connect to a cloud sql, i am working in eclipse kepler on windows. in the google cloud console i have authorized by app to access the database, they are both stored in the US.

To enable cloud sql for my app in eclipse i am going to google>app engine settings...

i try to configure the cloud sql instance, i am using the appropriate instance name : and i have specified the correct database name username and password, i have also tried with a blank password, and both a blank password and user niether have worked. additionally, i am using the same email account across my database and app engine and eclipse. the error i receive is:

Could not connect to Profile (<project>.GoogleCloudSQL.AppEngineInstance).
Error creating SQL Model Connection connection to 
Profile(<project>.GoogleCloudSQL.AppEngineInstance). (Error: Not authorized to access
instance: <instance:database>)
Not authorized to access instance: <instance:database>
Error creating Google Cloud SQL Connection factory connection to Profile  
(<project>.GoogleCloudSQL.AppEngineInstance). (Error: Not authorized to access 
instance: <instance:database>)
Not authorized to access instance: <instance:database>

i then tried to test the database using the google_sql.sh script provided in the bin folder of the appengine sdk. i sent me to a url to get an authorization code, after entering the authorization code i was just given the script fails stating "the provided authorization grant is invalid, expired, revoked etc.".

i just want my app engine java servlet to be able to access my cloud sql database...does anyone have any advice? a solution? a similar problem?

  • see this post for more details on what i have tried: http://stackoverflow.com/questions/20896237/app-engine-java-servlet-does-not-connect-to-cloud-sql – Gabriel Khaselev Jan 03 '14 at 05:32

1 Answers1

0

Please take a look at the following link for the recommended way to connect to your CloudSQL instance from dev purposes. https://developers.google.com/appengine/docs/java/cloud-sql/#connect_and_post

In short, just get an IP address for the CloudSQL instance using admin API or cloud console, authorize your network to access the CloudSQL instance through Cloud console, and point your application to it.

Amit
  • 104
  • 2
  • ive done that, and i can easily access the cloud sql instance when running the servlet on my local machine. once i deploy the servlet to app engine all of my database requests return "com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure" – Gabriel Khaselev Jan 03 '14 at 03:37
  • perhaps you should activate the billing if not done – JSmith May 18 '19 at 16:44