首页 > 解决方案 > JDBC 连接失败

问题描述

我正在尝试通过 JDBC 将 AWS Glue 连接到 Azure SQL Server。我尝试了 jdbc url 的不同设置但没有成功。URL 如下所示:

jdbc:sqlserver://domain.windows.net:1433/database
jdbc:sqlserver://domain.windows.net:1433;databaseName=database

在 AWS 的文档中,SQL Server 语法是jdbc:sqlserver://host:port;databaseName=db_name

出于测试目的,我使用了 Squirrel SQL 并成功连接到我的 Azure SQL Server。

当我尝试在 AWS Glue 中建立测试连接时,AWS CloudWatch 给了我以下日志:

Attempting to connect with SSL: jdbc:sqlserver://domain.windows.net:1433;database={database}
SSL connection to data store failed. Retrying without SSL.
Check that your connection definition references your JDBC database with correct URL syntax, username, and password. The TCP/IP connection to the host domain.windows.net, port 1433 has failed. Error: "Connection timed out: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".

对我来说奇怪的是连接中的“{”括号。Azure 的连接字符串告诉我,连接本身应该如下所示:

jdbc:sqlserver://domain.windows.net:1433;database=database

也许这是问题,但我不知道如何解决它。

标签: sql-serveramazon-web-servicesjdbcetlaws-glue

解决方案


因为您可以从 squirrel 成功连接到 Azure SQL;Azure 端的情况很好。

一个问题可能是 SSL;但很可能不是因为它在没有 SSL 的情况下重试也失败了。

在胶水端;请查看该端口是否允许出站连接。


推荐阅读