简体   繁体   English

如何使用DBEaver通过VM跳转主机连接到Azure SQL数据库?

[英]How to connect to Azure SQL Database through a VM jump host using DBEaver?

What I have:我拥有的:

  • Azure SQL Database on private virtual.network Azure SQL 私有 virtual.network 上的数据库
  • Jump host - Whitelisted Azure VM that can connect to the Azure SQL Database跳转主机 - 白名单 Azure VM 可以连接到 Azure SQL 数据库

Local machine --PuTTY--> Jump Host --sqlcmd--> Azure SQL DB本地机器--PuTTY--> 跳转主机--sqlcmd--> Azure SQL DB

What I want to do: Usually I PuTTY into the VM and use sqlcmd to operate, but the GUI is difficult to view when query a lot of data.我想做的事情:平时PuTTY到VM里面,用sqlcmd操作,但是查询数据多的时候GUI很难看。 So I want to use DBEaver on my local machine to access the Azure SQL Database.所以我想在我的本地机器上使用 DBEaver 来访问 Azure SQL 数据库。

Config used:使用的配置:

  • In Connection setting -> Main: Azure SQL Database (same server host, port, database, username, and password as usually used in sqlcmd )在 Connection setting -> Main: Azure SQL Database (与sqlcmd中通常使用的服务器主机、端口、数据库、用户名和密码相同)
  • In Connection setting -> SSH: Jump host在连接设置->SSH:跳转主机
  • In Connection setting -> Main -> Edit Driver Settings -> Libraries: jdbc 9.4.1.jre8 and jdbc_auth 9.4.1.x64在连接设置 -> 主要 -> 编辑驱动程序设置 -> 库中:jdbc 9.4.1.jre8 和 jdbc_auth 9.4.1.x64

Problem I face: I tried to use ssh tunnel configuration to connect.我面临的问题:我尝试使用 ssh 隧道配置进行连接。 In image 1 , when I click "Test tunnel configuration", it can successfully connect to the whitelisted VM.图 1中,当我单击“测试隧道配置”时,它可以成功连接到列入白名单的 VM。

a) In image 2 main config, I tried to use hostname in host and click "Test connection". a) 在图 2主配置中,我尝试在主机中使用主机名并单击“测试连接”。 It failed with error message它失败并显示错误消息

Cannot open server "127.0.0.1" requested by the login.无法打开登录请求的服务器“127.0.0.1”。 The login failed.登录失败。

b) In image 2 main config, I changed hostname as server IP (using ping <hostname> in jump host) and retry. b) 在图 2主配置中,我将主机名更改为服务器 IP(在跳转主机中使用ping <hostname> )并重试。 It failed with error message它失败并显示错误消息

Cannot open server "127.0.0.1" requested by the login.无法打开登录请求的服务器“127.0.0.1”。 The login failed.登录失败。

c) In image 2 main config, I tried to use random IP address in host and click "Test connection". c) 在图 2主配置中,我尝试在主机中使用随机 IP 地址并单击“测试连接”。 It failed with error message它失败并显示错误消息

The TCP/IP connection to the host 127.0.0.1, port 45851 has failed.与主机 127.0.0.1、端口 45851 的 TCP/IP 连接失败。 Error: "The driver received an unexpected pre-login response. Verify the connection properties and check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. This driver can be used only with SQL Server 2005 or later.".错误:“驱动程序收到意外的登录前响应。验证连接属性并检查 SQL Server 的实例是否正在主机上运行并在端口上接受 TCP/IP 连接。此驱动程序只能与 SQL Server 2005 一起使用或以后。”。

What am I missing?我错过了什么?

dbeaver ssh tunnel config dbeaver main config dbeaver ssh 隧道配置dbeaver 主要配置

We have got the same issue.我们有同样的问题。 Azure SQL Database needs to know the instance name associated to your username. Azure SQL 数据库需要知道与您的用户名关联的实例名称。 Since you are using an ssh tunnel on 127.0.0.1, Azure can't know the name of the instance.由于您在 127.0.0.1 上使用 ssh 隧道,因此 Azure 无法知道实例的名称。 You need to add the database name to your sql login (not the one used for the jumpbox, but the one used to connect to the db):您需要将数据库名称添加到您的 sql 登录名(不是用于跳转箱的那个,而是用于连接到数据库的那个):

username@database_name.database.windows.net

Instead of代替

username

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

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