我无法使用JDBC连接通过SSH隧道连接到Azure数据库。 出于安全原因,我不能直接访问Azure数据库,但是有一个跳转服务器/隧道VM,可用于间接连接到数据库。
ssh -f vm_user@tunnel_vm_host -L 127.0.0.1:1433:mydb-server.database.windows.net:1433 -N
),然后通过127.0.0.1:1433
和dbuser@mydb-server.database.windows.net
连接到Azure DB是可行的com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host xxx.yyy.zzz.worker.database.windows.net, port 11111 has failed. Error: "Connection refused: connect. 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.".
127.0.0.1:randomport <--> 127.0.0.1:1433
)开始与Azure DB的通信,然后使用{{1}切换到隧道外部},由于防火墙而失败。要运行此程序,我缺少什么?
使用的驱动程序:
测试程序:
my-external-IP:randomport <--> xxx.yyy.zzz.worker.database.windows.net:11111
答案 0 :(得分:1)
数据库服务器的连接策略必须为代理,才能使用ssh隧道。
有关可用连接策略差异的详细信息,请参见Azure SQL Database and Azure Synapse Analytics connectivity architecture文章。