Reputation: 11
I tried the below code to fetch records from db4free mysql db and write to google sheet. but i get the following error "Check connection string, username and password." Can you please help me to connect to db4free? i can connect to other free online DBs but they only offer 5MB. where as db4free offer 200MB.
Please see the code below.
function readFromDB() {
var conn = Jdbc.getConnection("jdbc:sqlserver://db4free.net:3306;databaseName="cricketgame","USERNAME","PASSWORD");
var stmt = conn.createStatement();
var rs = stmt.executeQuery("select * from UserList");
var doc = SpreadsheetApp.create('data');
var cell = doc.getRange('a1');
var row = 0;
while(rs.next()) {
cell.offset(row, 0).setValue(rs.getString(1));
cell.offset(row, 1).setValue(rs.getString(2));
row++;
}
rs.close();
stmt.close();
conn.close();
}
Thank you in advance.
Upvotes: 1
Views: 1051
Reputation: 33
in time, the Google connection does not support version 8.0 of mysql. Works perfectly with 5.7 . The mysql of db4free.net have 8.0 version.
Upvotes: 0
Reputation: 8974
db4free.net offers MySQL servers not MSSQL. So your connection url should start with jdbc:mysql
not jdbc:sqlserver
.
Upvotes: 3