ReferenceError: jdbc is not defined

333 views
Skip to first unread message

Anthony Apollis

unread,
Mar 2, 2021, 6:46:40 AM3/2/21
to Google Apps Script Community
Can somebody help please?
I would like to connect mysql db to a google sheet. I would like to read date from more than one table into google sheets. I am having this problem from the follow script:

var HOST = '000'
var PORT = '3311'
var USERNAME = 'Anthony_bottles'
var PASSWORD = 'aa'
var DATABASE = 'sasoftco_bottles_app'
var DB_TYPE = 'mysql'


function createConnection(){
var url =  "jdbc:mysql://<HOST>[:<PORT>]/<DATABASE>"

var  connjdbc.getConnection("url","user","password")
 conn.close();
}

IRVYN CORNEJO

unread,
Mar 3, 2021, 3:32:13 AM3/3/21
to Google Apps Script Community
Hello, 
I solved it using this alternative 
getConnection(url, info)
var conn = Jdbc.getConnection('jdbc:mysql://yoursqlserver.example.com:3306/database_name',
                              {user: 'username', password: 'password'})


I also leave an example code, implementing this way of passing the parameters.
Reply all
Reply to author
Forward
0 new messages