Google Apps脚本查询到MariaDB [英] Google Apps Script query to MariaDB
问题描述
我们最近将数据移到了新服务器上,但是新服务器正在使用MariaDB.
We recently moved our data to a new server - however the new one is using MariaDB.
我们在电子表格的Google Apps脚本中进行了大量查询和计算.由于服务器切换,我们的脚本返回以下错误:
We do a lot of queries and calculations in Google Apps Script for spreadsheet. Since the server switch our scripts return the following error:
未知的系统变量"OPTION"(第21行,文件")
Unknown system variable 'OPTION' (line 21, file "")
第21行引用以下脚本中的查询:
Line 21 refers to the query inside the following script:
function mysql_invoice() {
// Replace the variables in this block with real values.
var address = 'xxx';
var user = 'xxx';
var userPwd = 'xxx';
var db = 'xxx';
var dbUrl = 'jdbc:mysql://' + address + '/' + db;
// Read up to 100000 rows of data from the table and log them.
var conn = Jdbc.getConnection(dbUrl, user, userPwd);
var stmt = conn.createStatement();
// Call SO DATA
stmt.setMaxRows(10000);
var start = new Date();
var rs = stmt.executeQuery("select * from sales_flat_invoice");
有什么想法吗?
推荐答案
我相信您使用setMaxRows的方式就是问题所在.
I believe the way you used setMaxRows is the problem.
如果您更改设置限制的方式,它将起作用.
If you change the way you set the limit it will work.
// Call SO DATA
// stmt.setMaxRows(10000);
var start = new Date();
var rs = stmt.executeQuery("select * from sales_flat_invoice limit 10000");
这应该可以解决您的问题.这肯定是由于您的MariaDB版本与jdbc连接器版本不匹配所致.
This should fix your problem. This definetly comes from the missmatch of version of your MariaDB and the version of jdbc connector.
欢呼
这篇关于Google Apps脚本查询到MariaDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!