使用Google脚本连接到mariadb,错误:连接URL使用了不受支持的JDBC协议 [英] connect to mariadb using google scripts,error:Connection URL uses an unsupported JDBC protocol
问题描述
我正在使用 GOOGLE 中的代码正确地远程连接mariadb参数.
I am using codes from GOOGLE to connect to mariadb remotely with correct parameters.
// Replace the variables in this block with real values.
var address = 'database_IP_address';
var rootPwd = 'root_password';
var user = 'user_name';
var userPwd = 'user_password';
var db = 'database_name';
var root = 'root';
var instanceUrl = 'jdbc:mysql://' + address;
var dbUrl = instanceUrl + '/' + db;
// Create a new database within a Cloud SQL instance.
function createDatabase() {
var conn = Jdbc.getConnection(instanceUrl, root, rootPwd);
conn.createStatement().execute('CREATE DATABASE ' + db);
}
然后我得到了错误:连接URL使用了不受支持的JDBC协议.
then I got the error: Connection URL uses an unsupported JDBC protocol.
似乎我无法连接到Mariadb,我不知道连接问题是什么.
it seems that i cannot connect to Mariadb, I don't know what's the connection problem.
推荐答案
Mariadb不支持.
Mariadb is not supported.
在Apps脚本中,JDBC服务支持Google Cloud SQL,MySQL,Microsoft SQL Server和Oracle数据库.
In Apps Script, the JDBC service supports Google Cloud SQL, MySQL, Microsoft SQL Server, and Oracle databases.
如果要将Mariadb与Google Apps脚本一起使用,则需要编写REST API自己分层,以便您可以从Apps脚本向数据库进行简单的UrlFetch调用.该注释链接到 postgrest GitHub存储库作为REST API的示例.
If you want to use Mariadb with Google Apps Script, you will need to write a REST API layer yourself, so that you can make simple UrlFetch calls from Apps Script to your db. That comment links to the postgrest GitHub repository as an example of a REST API.
这篇关于使用Google脚本连接到mariadb,错误:连接URL使用了不受支持的JDBC协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!