Google Cloud App Engine stopped connecting to Cloud SQL - mysql

I've got a J2EE web application deployed to Google Cloud App Engine, which connects to a MySQL DB on Cloud SQL. All of a sudden it's stopped working. The GCP URL works fine and points to the correct web UI. I've re-tested the DB connection string on Google App Engine local host server, and it works absolutely fine. Public IP is enabled on Cloud SQL and my home network IP address is authorised. But clearly the cloud app engine code isn't talking to the Cloud SQL db.
Happy to share relevant code, but not sure what code would be helpful to share, as the app engine cloud URL is working, and the DB connection string is testing fine on localhost.
Does anyone have any trouble shooting tips on how I might get to the bottom of it? Has anything changed recently with GAE/Cloud SQL?
Thanks in advance...

Related

Google Cloud Engine with OpenVPN Server

Hello Stack Community,
I'm facing weird behavior of OpenVPN.
I'm running a OpenVPN Server on a Google Compute Engine with a Database. I would like to achive, to connect with a client via OpenVPN to the Google Compute Engine and insert data into the database.
If I'm connected to my home network everything works properly, I run OpenVPN Client as admin, get a secure connection within seconds and insert data into the database. Now the weird behavior. I'm at my parents place and using their network and my OpenVPN Client is not able to connect to my Google Compute Engine. OpenVPN Client run as admin and OpenVPN Server running on Google Cumpute Engine.
So I changed the network for the third time and I was again able to connect to my Google Compute Engine via OpenVPN.
Any Ideas why this is happening?

MySQL Connection error Google Cloud

I deploy a node + sql application I made testes running the node app in my laptop using mysql database provided by google and the application was working fine (I needed to allow my ip address to connect) but when I deployed the application I started to receive timeout errors in my app. I solved the problem allowing any ip address to connect in my google cloud mysql instance but I not happy with this solution. Anybody can help to allow just the production node app server ip?
Thanks in advance.
If you want your API key to only be accessed from a certain IP, you can restrict it in the Developers Console.

Cannot access Google Cloud SQL database from my App Engine

Last week I tried to setup Google Cloud for a NodeJS API and Cloud SQL database. Overall it works fine, but I can't access my Cloud SQL database. The authorization of the SQL database shows that all apps within the current project are granted to access the database. Unfortunality, this is not true. I need to granted the IP addresses of the instances from the App Engine. The IP adressess of the instances constantly changes after I deploy a newer version of the the API.
Does anybody have a solution to get access from the App Engine to the Cloud SQL database. It's very annoying to add constant the instance ip address to grant the database.
Sample here
Thank you in advance!
Jelle
I was going to suggest to assign a static IP to the app engine, but seems like it's not possible in App engine (it's possible in compute engine though). So lets tackle the root of the problem, you being unable to access cloud sql from App engine, are you sure you followed the instructions of the following link to the letter?
https://cloud.google.com/nodejs/getting-started/using-cloud-sql
This might solve your connection issue if you haven't.

Google App Engine API - Failed to Load Databases - Cloud SQL

I have a Google App Engine PHP website with MySQL database.
The website works and the database works correctly. I have connected the database instance to the application and I can access MySQL Client (and can perform queries).
But when I access the Google Cloud SQL API via the Google App Engine Developers Console (on the google developer console website) the database fails to load.
For example:
I select the correct application/database instance. I go on 'Google Cloud SQL' API and then 'SQL Prompts' but get:
Failed to load databases.
Any reasons as to why this is happening? and how to load the database? or why won't the database load in the first place?
Are you trying to access the link [1] to load your database in your browser.If yes then might be its a browser issue or multiple login problem.
[1] https://console.developers.google.com/project/app-id/sql/instances

How to connect to google cloud sql instance from eclipse using App Engine?

I am trying to connect to google cloud sql instance from eclipse in my app engine connected android project.
So far i am able to connect to cloud sql instance using Class.forname("com.mysql.jdbc.Driver"). But it requires authorising my ip address in google cloud sql every time i want to use the instance hence making it unfeasible.
I know that while connecting from app engine i dont need to authorize my ip address. Bur for that i have to use GoogleDriver ie. Class.forname("com.mysql.jdbc.GoogleDriver").
But when i run my code it gives me ClassNotFoundException.
I am stuck at this situation for a long time. Please give me a proper solution to the problem
The GoogleDriver is only intended to be used when actually running on App Engine. When running from eclipse or the dev_appserver you will have to use the stock com.mysql.jdbc.Driver class, and you will have to authorize your IP address. A good example of this is shown in the documentation, which demonstrates how to choose in code which driver to use. Note the commented out line for connecting from your dev environment to Cloud SQL.
As an FYI don't forget to enable the connector for running on App Engine.
I have authorised 0.0.0.0/0 in access control in my cloud instance and now all the devices are able to connect to the cloud instance with stock mysql driver ie. com.mysql.jdbc.Driver without need to changing authorised network again and again in access control.
Still can't figure out to implement GoogleDriver but for now this solution will work.
If anyone find a more better and general way to connect to cloud instance please post your answer.