-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The instance name is ignored when running on Linux #868
Comments
And 2.0.1 ? |
It's fine in 2.0.1, the bug was introduced in 2.1.0. We haven't checked the previews of 2.1.0. [Context: I'm a colleage of @RobClenshaw] |
On the same Windows machine ? - what happens if you try from a remote machine? |
It is on a remote machine. |
I have had a chance to test the preview releases – the bug is NOT present in 2.1.0-preview1.20235.1, and IS present in 2.1.0-preview2.20297.7. I've made a repo with a minimal test program, based on @RobClenshaw's above, plus a wrapper script to make it easier to run on different versions: https://github.com/mark-raymond/issue868 |
Line by line:
Edit: mdr-hp and mdr-win10 are both bare metal machines, on the same LAN, connected by ethernet. mdr-hp is running Ubuntu 16.04, mdr-win10 is running Windows 10 and has several SQL Server instances on it. |
Hi @RobClenshaw The issue is reproducible. You may connect to Instance Port in the mean time by setting connection string as: We are investigating the issue. |
Describe the bug
When connecting to a non-default instance from a Linux client, Microsoft.Data.SqlClient 2.1 and later ignores the instance name and instead connects to the default instance. Obviously this is a problem as it raises the possibility of executing code on an instance that you didn't know you were connected to.
To reproduce
Setup a Windows server with two SQL Server instances. Let's call them
server\defaultinstance
andserver\nondefaultinstance
. I have SQL Server Profiler open with two traces running - one on each instance.Using
dotnet new
create a console application using the following code and referenceMicrosoft.Data.SqlClient
2.1.1.I'm using an Ubuntu terminal in WSL2. In the terminal, change to the project directory and run
dotnet run
.Expected behavior
To see a batch with
SELECT 1
appear in the trace forserver\nondefaultinstance
Actual behavior
A batch with
SELECT 1
appears in the trace forserver\defaultinstance
Further technical details
Microsoft.Data.SqlClient version: 2.1.1 (but 2.1.0 is also affected)
.NET target: 5.0
SQL Server version: Have tested on 2017 and 2019
Operating system: Server 2019 for running the two SQL Server instances, Ubuntu 20.04 for running the application
The text was updated successfully, but these errors were encountered: