Do not update the DB name when connecting to DB pool (#1186)

* Do not update the DB name when connecting to DB pool

* Fix typo in the connection service
This commit is contained in:
Karl Burtram
2021-04-15 14:48:02 -07:00
committed by GitHub
parent 6bafed10eb
commit 6fe715d2d8
2 changed files with 66 additions and 45 deletions

View File

@@ -423,7 +423,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
// Update with the actual database name in connectionInfo and result
// Doing this here as we know the connection is open - expect to do this only on connecting
connectionInfo.ConnectionDetails.DatabaseName = connection.Database;
// Do not update the DB name if it is a DB Pool database name (e.g. "db@pool")
if (!ConnectionService.IsDbPool(connectionInfo.ConnectionDetails.DatabaseName))
{
connectionInfo.ConnectionDetails.DatabaseName = connection.Database;
}
if (!string.IsNullOrEmpty(connectionInfo.ConnectionDetails.ConnectionString))
{
// If the connection was set up with a connection string, use the connection string to get the details
@@ -1612,6 +1617,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
}
}
}
public static bool IsDbPool(string databaseName)
{
return databaseName != null ? databaseName.IndexOf('@') != -1 : false;
}
}
public class AzureAccessToken : IRenewableToken