使用 google 脚本连接到 mariadb,错误:连接 URL 使用不受支持的 JDBC 协议 [英] connect to mariadb using google scripts,error:Connection URL uses an unsupported JDBC protocol

查看:31
本文介绍了使用 google 脚本连接到 mariadb,错误:连接 URL 使用不受支持的 JDBC 协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用来自 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 Script 中,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 Script 对您的数据库进行简单的 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆