0
我在我的谷歌應用腳本中使用文檔屬性來存儲mysql數據庫連接字符串並獲取錯誤TypeError:無法在第2行調用方法「setProperties」null的空白不知道什麼原因可能是。谷歌應用腳本方法getDocumentProperties返回null
dbmysqlconndev = PropertiesService.getDocumentProperties();
dbmysqlconndev.setProperties({
'mysqlUrl': 'jdbc:mysql://dbserverdev;databaseName=sample',
'mysqlUser': 'username',
'mysqlPassword': 'password'});
var keys = dbmysqlconndev.getKeys();
for (var i = 0; i < keys.length; i++) {
dbmysqlconndev.getProperty(keys[i]);
}
var mysqlurl = dbmysqlconndev.getProperty(keys[0]);
var mysqlusr = dbmysqlconndev.getProperty(keys[1]);
var mysqlpwd = dbmysqlconndev.getProperty(keys[2]);
我想爲我的MySQL數據庫連接字符串創建一個腳本庫,並從其他腳本調用函數DBConn()。 – user25407
dbmysqlconndev = PropertiesService.getDocumentProperties(); dbmysqlconndev.setProperties('mysqlUrl':'jdbc:mysql:// dbtest; databaseName = test', 'mysqlUsr':'un', 'mysqlPwd':'pd'}); var keys = dbmysqlconndev.getKeys(); for(var i = 0; i
user25407