@@ -364,7 +364,7 @@ public async Task<bool> TryResetConnectionAsync(ConnectionSettings cs, IOBehavio
364
364
365
365
try
366
366
{
367
- if ( ServerVersion . Version . CompareTo ( ServerVersions . SupportsResetConnection ) >= 0 )
367
+ if ( DatabaseOverride == null && ServerVersion . Version . CompareTo ( ServerVersions . SupportsResetConnection ) >= 0 )
368
368
{
369
369
m_logArguments [ 1 ] = ServerVersion . OriginalString ;
370
370
Log . Debug ( "Session{0} ServerVersion={1} supports reset connection; sending reset connection request" , m_logArguments ) ;
@@ -380,8 +380,17 @@ public async Task<bool> TryResetConnectionAsync(ConnectionSettings cs, IOBehavio
380
380
else
381
381
{
382
382
// optimistically hash the password with the challenge from the initial handshake (supported by MariaDB; doesn't appear to be supported by MySQL)
383
- m_logArguments [ 1 ] = ServerVersion . OriginalString ;
384
- Log . Debug ( "Session{0} ServerVersion={1} doesn't support reset connection; sending change user request" , m_logArguments ) ;
383
+ if ( DatabaseOverride == null )
384
+ {
385
+ m_logArguments [ 1 ] = ServerVersion . OriginalString ;
386
+ Log . Debug ( "Session{0} ServerVersion={1} doesn't support reset connection; sending change user request" , m_logArguments ) ;
387
+ }
388
+ else
389
+ {
390
+ m_logArguments [ 1 ] = DatabaseOverride ;
391
+ Log . Debug ( "Session{0} sending change user request due to changed Database={1}" , m_logArguments ) ;
392
+ DatabaseOverride = null ;
393
+ }
385
394
var hashedPassword = AuthenticationUtility . CreateAuthenticationResponse ( AuthPluginData , 0 , cs . Password ) ;
386
395
using ( var changeUserPayload = ChangeUserPayload . Create ( cs . UserID , hashedPassword , cs . Database , m_supportsConnectionAttributes ? s_connectionAttributes : null ) )
387
396
await SendAsync ( changeUserPayload , ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
0 commit comments