0
votes

There seems to be an issue with Google Apps Script JDBC Connection in recent days, where connection via a hostname fails, but specifying an IP works.

Error:

Failed to establish a database connection. Check connection string, username and password.

    function SQLTOGOOGLOOGLESPREADSHEET(sqlQuery) {
    var address = 'http://127.0.0.1/phpmyadmin/:3306';
    var user = 'root';
    var userPwd = '';
    var db = 'employee';
    var msSqlUrlSyntax ='jdbc:sqlserver://'

    var dbUrl = msSqlUrlSyntax + address + ';databaseName=' + db;

    // msSqlUrlSyntax = 'youOptionalTestingQuery'
    var conn = Jdbc.getConnection(dbUrl, user, userPwd);

}
1

1 Answers

0
votes

You have done it right. Using an IP address instead of hostnames work as workaround. This is a known bug. Also, this issue was cited in this SO post.