如何在AWS Glue中使用JDBC连接来连接SQLServer

时间:2019-11-13 09:56:54

标签: sql-server jdbc aws-glue

在提供JDBC URL格式后,我想使用JDBC连接选项将数据从Glue加载到SQL Server中

jdbc:sqlserver://host:port;databaseName=db_name, User name, and Password

,在测试连接时,出现以下错误。 谁能帮助我我哪里出错了?

2019-11-13 09:29:01 INFO  CatalogClient:682 - Got connection 'SQLServer' info from Catalog with url: jdbc:sqlserver://32.238.81.66:1433/Glue_Test
2019-11-13 09:29:02 INFO  CatalogClient:718 - JDBC configuration for connection Staken QLServer: JDBCConfiguration(url=jdbc:sqlserver://32.238.81.66:1433/Glue_Test, hostname=32.238.81.66, port=1433, databaseVendor=sqlserver, databaseVersion=null, connectionName=SQLServer, path=Glue_Test, subnetId=subnet-3d416a13, availabilityZone=us-east-1b, securityGroups=[sg-c4d3929b], enforceSSL=false, customJDBCCert=null, skipCustomJDBCCertValidation=null, customJDBCCertString=null)
2019-11-13 09:29:02 INFO  JdbcConnection:46 - Starting connecter. driver SQLServerDriver:2
2019-11-13 09:29:02 INFO  JdbcConnection:64 - Attempting to connect with SSL host matching: jdbc:sqlserver://32.238.81.66:1433;database={Glue_Test};hostNameInCertificate=32.238.81.66
2019-11-13 09:29:17 INFO  JdbcConnection:73 - SSL connection to data store using host matching failed. Retrying without host matching.
2019-11-13 09:29:17 INFO  JdbcConnection:87 - Attempting to connect with SSL: jdbc:sqlserver://32.238.81.66:1433;database={Glue_Test}
2019-11-13 09:29:32 INFO  JdbcConnection:92 - SSL connection to data store failed. Retrying without SSL.
2019-11-13 09:29:32 INFO  JdbcConnection:106 - Attempting to connect without SSL: jdbc:sqlserver://32.238.81.66:1433;database={Glue_Test}
Check that your connection definition references your JDBC database with correct URL syntax, username, and password. The TCP/IP connection to the host 32.238.81.66, 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.". Exiting with error code 30

1 个答案:

答案 0 :(得分:0)

胶水连接的工作方式与允许在任何VPC中进行通信的方式非常相似。 Glue将启动一个弹性网络接口,以促进与数据库的通信。您可以测试的第一件事是,在与数据库相同的子网和安全组中启动实例,然后执行“ nc -vz dbendpoint port”。这可以确认,如果您可以成功建立连接,则安全组允许在该端口上进行通信。

从胶水使用相同的子网和安全组,这应该没有问题。您也可以以此为参考:https://docs.aws.amazon.com/glue/latest/dg/start-connecting.html