簡體   English   中英

JDBC:Apps Script 和 Google MySQL:例外:您無權調用 Jdbc.getCloudSqlConnection

[英]JDBC: Apps Script and Google MySQL : Exception: You do not have permission to call Jdbc.getCloudSqlConnection

下面列出的代碼當我嘗試在我的電子表格中使用此 function 時,我收到以下錯誤:Google 腳本錯誤 - 異常:您無權調用 Jdbc.getCloudSqlConnection

有想法該怎么解決這個嗎? 似乎連接成功,但卡在創建表中

var connectionName = 'cosmic-tenure-310821:us-central1:propertydata';
var rootPwd = "password";
var user = "root";
var userPwd = 'password';
var db = 'propertydata';

var root = 'root';
var instanceUrl = "jdbc:google:mysql://" + connectionName;
var dbUrl = instanceUrl + "/" + db;

function createTable() {
  var conn = Jdbc.getCloudSqlConnection(dbUrl, user, userPwd);
  conn.createStatement().execute('CREATE TABLE myProperties(APN INT, APNObject MEDIUMBLOB)');
}

嘗試添加“oauthScopes”

"oauthScopes": ["https://www.googleapis.com/auth/gmail.addons.execute","https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/sqlservice", "https://www.googleapis.com/auth/sqlservice.admin", "https://www.googleapis.com/auth/gmail.readonly", "https://www.googleapis.com/auth/script.external_request", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/gmail.addons.current.action.compose"]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM