Skip to content
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

mssql named instance port number #1566

Open
adi1 opened this issue Mar 11, 2024 · 0 comments
Open

mssql named instance port number #1566

adi1 opened this issue Mar 11, 2024 · 0 comments

Comments

@adi1
Copy link

adi1 commented Mar 11, 2024

Describe the bug
When connecting to an mssql named instance, the connection string generated in tortoise.mssql.client.MSSQLClient still includes the port number. Named instances listen on dynamic ports, so the ,{port} should be left out, otherwise it tries to connect by default to port 1433 which fails.

To Reproduce
Create an mssql connection with host containing a named instance, for example my_server\my_instance

Expected behavior
It should work

Additional context
One possible fix could be:

    if "\\" in host:
        # named instance, don't provide port
        server = host
    else:
        server = f"{host},{port}"
    self.dsn = f"DRIVER={driver};SERVER={server};UID={user};PWD={password};"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant