简体   繁体   English

Google App Maker 可以连接到 Azure 中的 MS SqlServer 数据库吗?

[英]Can Google App Maker connect to MS SqlServer Database in Azure?

thanks for reading.谢谢阅读。 I have added the App Maker APIs to the Azure firewall as described here I have tried connecting from App Maker to the sqlserver database on azure several ways, and I have triple checked my username and password and used it to connect directly to the database in other applications.我已将 App Maker API 添加到 Azure 防火墙中,如此所述 我尝试通过多种方式从 App Maker 连接到 azure 上的 sqlserver 数据库,并且我已经三次检查了我的用户名和密码,并使用它直接连接到其他数据库应用程序。

Here are some things I have tried:以下是我尝试过的一些事情:

var dbUrl = 'jdbc:sqlserver://mydatabase.database.windows.net:1433/mydatabase';
var user = 'myusername';
var userPwd = 'mypassword';

function getJDBCConnection() {
  try {
    return Jdbc.getConnection(dbUrl, user, userPwd);
  } catch (err) {
    if (err.message.match(/Failed to establish a database connection/)) {
      throw new Error(err.message + ' Please refer to the ReadMe and edit ' +
                      'your database settings!');
    } else {
      throw err;
    }
  }
}

and I have also tried creating the connection directly with two methods, first:我也尝试过使用两种方法直接创建连接,首先:

    var conn = Jdbc.getConnection('jdbc:sqlserver://mydatabase.database.windows.net:1433/mydatabase','username', 'password');

and also like this也像这样

    var conn = Jdbc.getConnection('jdbc:sqlserver://mydatabase.database.windows.net:1433/mydatabase', {user: 'username', password: 'password'});

any advice is greatly appreciated.任何意见是极大的赞赏。

According what I found, when Gooele APP using JDBC connect to Microsoft SQL server, the connection string has some difference.据我发现,当谷歌APP使用JDBC连接微软SQL服务器时,连接字符串有一定的差异。

Here's the example of connection URL:以下是连接 URL 的示例:

String connectionUrl = "jdbc:sqlserver://<server>:<port>;" +  
   "databaseName=AdventureWorks;user=MyUserName;password=*****;"; 

Reference:参考:

  1. JDBC: Making a simple connection to a database JDBC:建立与数据库的简单连接
  2. JDBC: Connection URL sample JDBC:连接 URL 样品

This blog has the same error when connect to Microsoft SQL server, and it solved by change the connection URL: Error when connecting to MSSQL Server with Google Apps Script via JDBC此博客在连接到 Microsoft SQL 服务器时出现相同的错误,并通过更改连接 URL: Error when connected to MSSQL Server with Google Apps Script via Z82269B9B71AB4A7732F69586102Z

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM