Cannot connect to 2nd generation instance from eclipse

197 views
Skip to first unread message

Vaishnavi Manjunath

unread,
Dec 5, 2016, 12:23:12 PM12/5/16
to Google Cloud SQL discuss
Hi,
   I was able to create sample RESTful application using jersey and jackson and deploy it on GAE. The next thing i want to do is to connect to Google cloud 2nd generation SQL instance which I am unable to do. I will just list steps i followed for better clarity.

1. created a 2nd gen instance associated with GAE project, under root user i changed password.
2. created a database and with help of cloud shell, created a table with 1 record in that database.
3. made a note of instance connection name, database name, username and password.
4. installed mysql installer, was able to install mysql server , command client tool
5. made note of my machine IP address, added it under authorized networks of sql instance.
5. installed mysql-connector-java-5.1.14 jar file , added it to the LIB folder of WEB/INF(added build path)
6. made changes to appengine-web.xml  as per this link: https://cloud.google.com/appengine/docs/java/cloud-sql/
   in both the property name tags i have added instance connection name, dbname, username and password.( i read in few blogs that its not needed in both)- please provide clarity on this and i am not sure what these 
  two tags mean.
7. So after all this, I went to project->google->appengine settings-> enable google cloud sql 
  under this there are three options
  •   mysql instance and google cloud sql instance (i want to know difference between both) and app engine SQL instance
I am not sure which one to configure to test locally and when app is deployed.], more light on local mysql instance would be of great help :)

8. I tried configuring all the three , and ended up getting error:
   

"Could not connect to Profile (test.GoogleCloudSQL.AppEngineInstance).
Error creating SQL Model Connection connection to Profile (test.GoogleCloudSQL.AppEngineInstance). (Error: com.mysql.jdbc.Driver)
com.mysql.jdbc.Driver
Error creating Google Cloud SQL Connection factory connection to Profile (test.GoogleCloudSQL.AppEngineInstance). (Error: com.mysql.jdbc.Driver)
com.mysql.jdbc.Driver"

I did read that this problem exists because jar file is not added, but i have added it as mentioned above.

9. I even installed DTP in eclipse, added new driver connection with MySQL, MySQL jdbc driver and included the same jar file as mentioned above.
I am using GAE version : 1.9.46 , eclipse NEON.
I would also like to mention that I havent written any JDBC code to connect, was exploring this option first as required in: https://developers.google.com/eclipse/docs/cloudsql-createapp#locally

  
So I am absolutely clueless as what to do next, your help will be appreciated  :)

Thanks,
Vaishnavi :)

Les Vogel

unread,
Dec 20, 2016, 9:07:42 AM12/20/16
to Google Cloud SQL discuss
Hi,

Sorry for the delay.  Take a look at the updated sample: https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/appengine/cloudsql -- If you still have trouble, let us know.

Les
Reply all
Reply to author
Forward
0 new messages