Issue Connecting to Local SQL Express Server via SSH Tunnel

Hello Support Team,

I have a local SQL Server Express instance, and I have set up SSH tunneling successfully. I can see the local SQL Server, but I am getting a login failure, which indicates the tunnel itself is working.

The issue seems to be in the configuration:

  1. When I set the server name to the local SQL Server's IP addres*, and enter the database name, the connection does not reach the SQL Server at all.
  2. When I enter the **instance name instead of the database name, I receive the following error:

Login failed for user 'sa'. Reason: Failed to open the explicitly specified database 'XXX'. [CLIENT: 127.0.0.1]


3. I have tried multiple combinations, including:
  * Using the instance name in the server address.
  * Using the instance name in the database name field.
  * Creating an alias in SQL Server Configuration Manager to replace `IP + instance name` with just `IP`.

Despite all these attempts, the connection still fails.

✅ Username and password are correct* (verified).
❌ SQL logs show no connection attempts when using some configurations.

Could you please advise on the correct way to configure Retool for connecting to a local SQL Express instance via SSH tunnel? 
 > [Troubleshoot resource connections](https://docs.retool.com/data-sources/guides/troubleshooting)

@Paulo we jus sepak on office hours.

@Paulo From the internet, using a MacOS terminal, I established an SSH connection to a computer where the database is hosted locally (MS SQL Expres running on Windows 10). Then, I ran the following connection string through the SSH tunnel: sqlcmd -S 127.0.0.1\INSTANCENAME -U USERNAME -P PASSWORD. The connection was successful. I also tested the following variation sqlcmd -S 127.0.0.1 -U USERNAME -P PASSWORD` - excluding INSTANCENAME. However, I should mention that I configured an alias for this connection in the SQL Server Configuration Manager. This alias was also in place during our tests in Office Hours.

For reference, I am currently dealing with a login error when connecting to a local named instance of SQL Server. Since the error logs are generated on the local SQL Server, there is no indication that the SSH configuration is incorrect—especially given that I successfully tested the connection as described above.

Over the weekend, I will reinstall SQL Server with a simpler configuration (without a named instance) and will report back on whether this resolves the issue.

1 Like

Hey @Lukasz_Wita! Thanks for joining office hours the other day. :slightly_smiling_face:

I'm curious to know if installing the non-named version of SQL Server fixed this particular issue. Looking at the implementation of the connector internally, it looks like it should!