I also tried to connect to Google Cloud SQL from my Google App Script.
Searched many places. The exception is showed below.
Please help me.
The error is too generic.
The connection name and database name were taken from the Google cloud console
Connection name - copied from the overview page
database name - copied from the Database menu item under the name column
function connectToGoogleCloudSQL() {
const connectionName = 'projectname:regionname:dbinstancename'
const dbName = 'dbname'
const username = 'myusername'
const password = 'mypassword'
const conn = Jdbc.getCloudSqlConnection("jdbc:google:mysql://${connectionName}/${dbName}", username, password); <---- Line 130
9:04:01 AM
Error
Exception: Failed to establish a database connection. Check connection string, username and password.
connectToGoogleCloudSQL
@ Code.gs:130