简体   繁体   中英

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

What I have:

  • Azure SQL Database on private virtual.network
  • Jump host - Whitelisted Azure VM that can connect to the Azure SQL Database

Local machine --PuTTY--> Jump Host --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. So I want to use DBEaver on my local machine to access the Azure SQL Database.

Config used:

  • In Connection setting -> Main: Azure SQL Database (same server host, port, database, username, and password as usually used in sqlcmd )
  • In Connection setting -> SSH: Jump host
  • In Connection setting -> Main -> Edit Driver Settings -> Libraries: jdbc 9.4.1.jre8 and jdbc_auth 9.4.1.x64

Problem I face: I tried to use ssh tunnel configuration to connect. In image 1 , when I click "Test tunnel configuration", it can successfully connect to the whitelisted VM.

a) In image 2 main config, I tried to use hostname in host and click "Test connection". It failed with error message

Cannot open server "127.0.0.1" requested by the login. The login failed.

b) In image 2 main config, I changed hostname as server IP (using ping <hostname> in jump host) and retry. It failed with error message

Cannot open server "127.0.0.1" requested by the login. The login failed.

c) In image 2 main config, I tried to use random IP address in host and click "Test connection". It failed with error message

The TCP/IP connection to the host 127.0.0.1, port 45851 has failed. 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.".

What am I missing?

dbeaver ssh tunnel config dbeaver main config

We have got the same issue. Azure SQL Database needs to know the instance name associated to your username. Since you are using an ssh tunnel on 127.0.0.1, Azure can't know the name of the instance. 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):

username@database_name.database.windows.net

Instead of

username

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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