// Connection to Google form
var form = FormApp.openById('*********************************');
// Connection variable
var instanceConnectionName = '*****:*******:*******';
var user = 'root';
var userPwd = '**********';
var db = '********';
var dbUrl = 'jdbc:mysql://' + connectionName + '/' + db;
// Receive form response and replicate to a row in SQL table
function handleFormSubmit( event ) {
var conn = Jdbc.getConnection(dbUrl, user, userPwd);
var stmt = conn.prepareStatement('INSERT INTO eform '
+ '(Timestamp, Email, Department, Acknowledge) values (?, ?, ?, ?)');
stmt.setString(1, event.namedValues['Timestamp']);
stmt.setString(2, event.namedValues['Email']);
stmt.setString(2, event.namedValues['Department']);
stmt.setString(3, event.namedValues['Acknowledge']);
stmt.execute();
}
我尝试了上面的代码将Google Form数据保存到我的Cloud SQL实例之一,但出现此错误:
知道为什么吗?无论如何,这是正确的方法吗?我相信连接变量中没有拼写错误,而且我卡住了...