-
Notifications
You must be signed in to change notification settings - Fork 155
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
fall back to master when connected to secondary #854
Conversation
Is the fallback to master a feature of SSMS currently? |
src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/DatabaseTreeNode.cs
Show resolved
Hide resolved
src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/DatabaseTreeNode.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/SmoModel/DatabaseTreeNode.cs
Show resolved
Hide resolved
SSMS doesn't have this issue because its object explorer root is not database-scoped. It always displays the full result of sys.databases query regardless of whether the connection string has an initial catalog. |
Is this behavior change a good change then? I worry that this might surprise (not necessarily pleasantly) the user. Consider a scenario where a user has database1, database2 and master on her server. Further assume that that database1 is production, database2 is pre-production and master is her development test instance, so all there has same user database objects and schema. Now when she mistypes database1 and database2 in her connection strings to db1 and db2 or some such, she silently gets connected to master and she may not realize that this has happened for quite some time since a lot of child nodes on the database would have the object that she expects! |
if "initial catalog=somename" is in the string, and "somename" doesn't exist on the server at all, the connection attempt itself will fail. |
ie we still get this dialog: System.Data.SqlClient.SqlException (0x80131904): Cannot open database "myfunky" requested by the login. The login failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. and then let's get a build to release it so we can pull into latest Insiders. Thanks David!
If the database name in the connection string doesn't match any database found in sys.databases, fall back to master for the database node in Object Explorer.