Answer the question
In order to leave comments, you need to log in
Google Apps Script Jdbc.getConnection how to connect to MySQL?
Good afternoon, I need advice from a practitioner who really has a connection string.
function Test(){
var connectionName = 'remotemysql.com';
var user = 'xaqfnhqzgE';
var userPwd = 'o8uJU5UeIH';
var db = 'xaqfnhqzgE';
var dbUrl = 'jdbc:mysql://'+connectionName+'/'+db;
var conn = Jdbc.getConnection(dbUrl, user, userPwd);
//var conn = Jdbc.getConnection('jdbc:mysql://37.59.55.185:3306/xaqfnhqzgE','xaqfnhqzgE','o8uJU5UeIH');
conn.close();
}
Answer the question
In order to leave comments, you need to log in
Classic version
var conn = Jdbc.getConnection(
'jdbc:mysql://sql4.freemysqlhosting.net:3306/sql427628?useUnicode=true&characterEncoding=UTF-8',
'sql427628', '****');
var stmt = conn.createStatement();
stmt.setMaxRows(1000);
var start = new Date();
var rs = stmt.executeQuery('select * from person');
var row = 0;
while (rs.next())
for (var col = 0; col < rs.getMetaData().getColumnCount(); col++)
console.log(rs.getString(col + 1));
rs.close();
stmt.close();
conn.close();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question