对 MariaDB 的 Google Apps 脚本查询 [英] 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.
干杯
这篇关于对 MariaDB 的 Google Apps 脚本查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!