I followed the Google Apps Script JDBC example shown at https://developers.google.com/apps-script/jdbc but have been unsuccessful connecting to a MySQL database hosted at Amazon. My connection string looks like this (scrubbed):
var conn = Jdbc.getConnection("jdbc:mysql://myAmazonhost:3306/", "myUser", "myPass");
I'm able to connect remotely to the Amazon MySQL database from my development system using both MySQL Workbench and Navicat and have checked/verified the host name, username and password in the Google script.
I added the Google servers listed under Accessing Local Databases to the Amazon Security Group but no luck. I keep getting the error:
Failed to establish a database connection. Check connection string, username and password.
I'm probably missing something simple. Anyone else connecting from a Google script to an Amazon MySQL database? I'd sure appreciate any advice. Thanks.
(Edit...)
Sorry, I inadvertently removed the database name when I sanitized my example above. The DB name is specified in the code.
var conn = Jdbc.getConnection("jdbc:mysql://myAmazonhost:3306/myDB", "myUser", "myPass");
Twelve hours after I posted this question, the script started working--no database connection errors. I built a report that created a spreadsheet using information retrieved from the Amazon MySQL database. (So cool to see all this working in the cloud.)
But... I hadn't made any changes to the JDBC connection string. And no changes were made to the Security Group configuration on the Amazon side. It just started working.
This morning, I started working on the script. I didn't get very far--the big ugly red database connection error message popped up. No changes to code. It just stopped working. I verified the MySQL database is up and accessible from my desktop admin program. No issues.
Is anyone else experiencing erratic connections from Google scripts to external databases? I'm hoping this is just an isolated glitch.