4
  1. Google Cloud SQL: after an upgrade SQL from the first generation to second MySQL workbench can’t connect my instance in Cloud. Why? Maybe you need to do instance 5.7 ?

  2. Google application Engine: after upgrade SQL from the first generation to second MySQL opening a new WEB application and connect to my project in Cloud, it can’t see my instance. Why?

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
user2258777
  • 71
  • 1
  • 8
  • Can you provide more details about your use case / setup ? From where you're trying to connect to your SQL instance (inside / outside of GCP) ? What kind of error you're getting (provide some logs if you can - that helps a lot). – Wojtek_B Mar 09 '20 at 08:39
  • And - have you read about upgrading from gen 1 > gen 2 and app engine connectivity ? https://cloud.google.com/sql/docs/mysql/upgrade-2nd-gen#considerations_for_applications_connecting_from_standard_environment – Wojtek_B Mar 09 '20 at 09:39
  • The first is solved. We created an instance in Cloud SQL 5.7 and database is working. The second problem is that GAE application is not able to connect the second generation of Cloud SQL. Probably I have to rewrite my application. It is still possible to use GWT/GAE tools? – user2258777 Mar 10 '20 at 15:46
  • In the project properties I have to change the name of instance.This gives a message:Could not connect to Profile (northwestwild.GoogleCloudSQL.DevInstance). Error creating SQL Model Connection connection to Profile (northwestwild.GoogleCloudSQL.DevInstance). (Error: com.mysql.jdbc.Driver) com.mysql.jdbc.Driver Error creating Google Cloud SQL Connection factory connection to Profile (northwestwild.GoogleCloudSQL.DevInstance). (Error: com.mysql.jdbc.Driver) com.mysql.jdbc.Driver – user2258777 Mar 10 '20 at 16:14
  • I'm not certain about the second part - what you're exactly doing; are you changing the name of the sql instance and then you can't connect from your app (from app engine) ? Can you clarify ? – Wojtek_B Mar 11 '20 at 08:35
  • PLEASE HELP ME! if it is possible to easily translate GAE first generation applications into current generation? Do I have to start everything from the beginning? – user2258777 Mar 11 '20 at 12:20
  • The application was written 5 years ago with Eclipse 4.6.3 and GAE / GWT appengine-java-sdk-1.9.59. For the application to work, it must connect to the project and database. Cloud SQL generation upgrade changed instance name. So, I have to change it in the application and I can't do it because the old GAE doesn't see the new instance. This is not in the program code just project set up:Could not connect to Profile (northwestwild.GoogleCloudSQL.DevInstance). Error creating SQL Model Connection connection to Profile (northwestwild.GoogleCloudSQL.DevInstance). (Error: com.mysql.jdbc.Driver) – user2258777 Mar 11 '20 at 14:48
  • Right now you really have to update your application (make changes to the code) to be able to connect to your DB. 2nd gen CloudSQL uses VM's instead of containers (1st gen) hence the different way of connecting & need to change in app code. Otherwise your app won't connect. – Wojtek_B Mar 12 '20 at 09:25
  • In my code is: String driverName = "com.mysql.jdbc.Driver"; Class.forName(driverName); DriverManager.registerDriver(new AppEngineDriver()); mySQL = DriverManager.getConnection("jdbc:google:rdbms://northwestwild-1055:us-central1:dbicamera/cameraidb"); Is there any translator to make the application of the previous GAE version work in the new GAE version? – user2258777 Mar 12 '20 at 15:10
  • Is it possible that we need credentials? Do we need to change something in the setting of our project? Why is the application unable to connect to the database? Google has radically changed the way applications are executed and I can't find instructions on how to prepare applications. – user2258777 Mar 13 '20 at 03:16
  • I have a Google Web Toolkit (GWT) application (Java, MySQL) that is running on Google App Engine. The app is running fine, but I haven't touched the code in a while. Now I need to modify access to the database in the in the program code, but I can't get Eclipse/AppEngine to deploy the project any more. I have Eclipse JEE Neon 4.6.3 and a new Eclipse JEE-2019-12. How can I transform my project so that it can be installed in the cloud? – user2258777 Mar 22 '20 at 14:36

1 Answers1

4

Any of these three configurations might eventually prevent the connection from GAE:


a) If you haven't assigned any public IP address to the instance;

the only option to connect would be: Configuring Serverless VPC Access.


b) Confirm and complete the upgrade reads:

If your applications are connecting using the First Generation instance connection name:

<project_id>:<instance_id>

update them to use the Second Generation instance connection name:

<project_id>:<region>:<instance_id>

c) Another possible culprit would be the service-account used - and it's assigned roles:

App Engine uses a service account to authorize your connections to Cloud SQL. This service account must have the correct IAM permissions to successfully connect. Unless otherwise configured, the default service account is in the format service-PROJECT_NUMBER@gae-api-prod.google.com.iam.gserviceaccount.com.


Authorization with authorized networks is usually not required when connecting from GAE.

Community
  • 1
  • 1
Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • It is not instance problem. I can see my database with MySQL workbench..It looks like GAE (Eclipse Neon) doesn't accept the old project structure and doesn't connect to the cloud. I can't find information on how to translate old to new GAE project. Eclpse-2019-12 sees my cloud, but I don't know how to integrate it with my working code in the proposed structure – user2258777 Mar 22 '20 at 20:56
  • Try updating the workbench's mySQL client library to the same version as the remote server; JDBC should usually work with any/most versions. – Martin Zeitler Mar 23 '20 at 08:30
  • I DO NOT have a problem with MySQLworkbench. It works perfectly. I have a problem with GAE/GWT application. Application can not connect to my project in the cloud. It must be rewritten, but I don't know how. – user2258777 Mar 23 '20 at 12:23
  • @user2258777 double check the connection string used, which is the only thing to change on the application side (your question does not tell which GAE environment it is, while the connection string varies for these). There's a whole lot such questions on here: https://www.google.com/search?q=google+cloudsql+migrate+to+second+generation+site:stackoverflow.com – Martin Zeitler Mar 29 '20 at 20:35