Skip to content

MSSQL connection fails when the database name is typed instead of picked from the dropdown #1243

Description

@marvdgf

Description

First of all, thank you for DBCode. We appreciate the plugin very much. Here is a small issue we ran into.

When I create a new Microsoft SQL Server connection, the Database field accepts typed text. If I type the database name by hand, the connection fails. It only works if I pick the database from the dropdown, or load the list with sync/refresh and then pick it.

The field accepts free text, so a typed name that matches an existing database should work the same as one picked from the list.

Steps to reproduce

Open DBCode and add a new connection.
Choose Microsoft SQL Server as the connection type.
Enter the server, authentication and credentials.
Type an existing database name into the Database field by hand (for example MyDatabase). Don't pick it from the dropdown.
Save or connect.
Expected behavior

DBCode connects to the typed database, just as it does when the same name is picked from the dropdown.

Actual behavior

The connection fails. If I open the same connection, pick the same database from the dropdown (after syncing the list if needed) and save, it connects without problems.

Error message

Login failed for %user_name%

Workaround

Don't type the database name. Load the list with sync/refresh and pick the database from the dropdown.

Possible cause (assumption)

The dropdown selection may set a different internal value than the text field, or add one alongside it (for example a database ID or a separate property). A typed name may never reach the connection string. If typed text isn't meant to be supported, the field should be select-only, or show a validation hint.

Environment

DBCode version: 1.38.6
VS Code version: Latest
OS: Windows 11 Enterprise
SQL Server version: Microsoft SQL Server 2019
Authentication type: SQL

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions