Urgent help needed please! Google cloud SQL connection error

532 views
Skip to first unread message

Mohamed Karam

unread,
May 11, 2021, 7:44:19 AM5/11/21
to Google Apps Script Community
Today, I started getting consistent " Failed to establish a database connection. Check connection string, username and password" when I try to connect to a Google cloud sql database. I am using the method Jdbc.getConnection. Everything was working jhust fine until yesterday. I tried authorizing all Google servers IP addresses, which didn't resolve the issue. Then I authorized  0.0.0.0/0, which should authorize all networks. Also, checked the release notes for cloud sql and couldn't find anything that may be causing the issue.

Bauke de Kroon

unread,
May 11, 2021, 8:38:56 AM5/11/21
to Google Apps Script Community
Hello Mohamed,

I had the same error message. I got this solved by using the Jdbc.getCloudSqlConnection method instead of Jdbc.getConnection. The Jdbc.getCloudSqlConnection is the recommended way as you don't have to authorise any Google server IPs. Hope this helps.

Stephen Putman

unread,
May 11, 2021, 10:01:25 AM5/11/21
to Google Apps Script Community
I'm having this same issue... I tried the Jdbc.getCloudSqlConnection, but have had no success so far.  All of cloud apps are shut down due to this.

Stephen Putman

unread,
May 11, 2021, 10:06:33 AM5/11/21
to Google Apps Script Community
I should note that I've so far been able to connect and run queries in the Google Cloud Shell and using mySQL Workbench

gabriel...@thoughtworks.com

unread,
May 11, 2021, 10:30:10 AM5/11/21
to Google Apps Script Community
Hi everyone, I'm facing the same issue.

Has anyone found out a solution?

gabriel...@thoughtworks.com

unread,
May 11, 2021, 10:38:52 AM5/11/21
to Google Apps Script Community
I just notice that there are some issues created on Google Issue Tracker:

https://issuetracker.google.com/issues/187750420
https://issuetracker.google.com/issues/187573928

Stephen Putman

unread,
May 11, 2021, 11:21:37 AM5/11/21
to Google Apps Script Community
I found appending the url with 

?useSSL=false

sovles the issue for now.
Message has been deleted

Stephen Putman

unread,
May 11, 2021, 11:35:52 AM5/11/21
to Google Apps Script Community
Hi Gabriel.  In Google Apps Script, it's the address to the database and table.  Example:

let dbUrl = 'jdbc:mysql://' + dbIpAddress + '/' + dbTable + '?useSSL=false';
  //ex:  jdbc:mysql://106.196.10.211/mytable?useSSL=false

let conn = Jdbc.getConnection(dbUrl, dbUser, dbPass);

On Tuesday, May 11, 2021 at 9:31:08 AM UTC-6 gabriel...@thoughtworks.com wrote:
Hi, Stephen.

Thank you. Which URL do you mean?

gabriel...@thoughtworks.com

unread,
May 11, 2021, 11:36:51 AM5/11/21
to Google Apps Script Community

Thank you Stephen!

Stephen Putman

unread,
May 11, 2021, 12:23:29 PM5/11/21
to Google Apps Script Community
👍 No problem... take care, Gabriel! 

Stephen Putman

unread,
May 11, 2021, 12:30:09 PM5/11/21
to Google Apps Script Community
I just wanted to share one more thing:   I've had problems with the speed of my apps lately.  When troubleshooting this morning, I noticed the performance of these apps improves greatly when I rolled them back from V8.  I'm refactoring all my apps today and dropping V8.
Reply all
Reply to author
Forward
0 new messages