我正在使用以下代码连接到数据库:
var ServerIP = '[ip]';
var SQL_Port = '3306';
var SQL_Usr = '[user]';
var SQL_Pwd = '[pass]';
var SQL_DB = '[db-name]';
var connectorInstance = 'jdbc:mysql://' + ServerIP+':'+SQL_Port;
var ConnectString = connectorInstance+'/'+SQL_DB;
var conn = Jdbc.getConnection(ConnectString, SQL_Usr, SQL_Pwd);
//Executes the queries
var execStmt = conn.createStatement();
var doc = SpreadsheetApp.getActiveSpreadsheet();
doc.setActiveSheet(doc.getSheetByName('Sheet1'));
var mysqlQuery = execStmt.executeQuery("select Name, Status From data_table ORDER BY Name");
var cell = doc.getRange('A2');
var row = 0;
while(mysqlQuery.next()) {
for(var i=0; i<8; i++) {
cell.offset(row, i).setValue(mysqlQuery.getString(i+1));
}
row++;
}
mysqlQuery.close();
execStmt.close();
conn.close();
我需要使用以下存储过程:
call procedure_name()
在谷歌搜索之后,我无法理解我应该在代码中的何处以及如何实现这一行。