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

Received "error: 25 - Connection string is not valid" after upgrading from 2.0.1 to 2.1.1 #904

Closed
chgl opened this issue Feb 9, 2021 · 3 comments
Labels
2️⃣ Duplicate Issue/PR that is a duplicate and already exists.

Comments

@chgl
Copy link

chgl commented Feb 9, 2021

(Originally raised at microsoft/fhir-server#1623)

Describe the bug

After upgrading from version 2.0.1 to 2.1.1 a Microsoft.Data.SqlClient.SqlException (0x80131904) is thrown stating that the previously working connection string is invalid (provider: TCP Provider, error: 25 - Connection string is not valid)

The connection string looks roughly like this:

Server=tcp:db.example.com\INSTANCE1,1533;Initial Catalog=FHIR;Persist Security Info=False;User ID=fhir;Password=password123;MultipleActiveResultSets=False;Connection Timeout=30

Maybe it's related to the INSTANCE1 or custom port 1533?

Exception message: 

Unhandled exception. Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 25 - Connection string is not valid)

Stack trace:

2021-01-30T21:26:12.979963942+01:00 stderr F Unhandled exception. Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 25 - Connection string is not valid)
2021-01-30T21:26:12.980011342+01:00 stderr F at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
2021-01-30T21:26:12.980021741+01:00 stderr F at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
2021-01-30T21:26:12.980028556+01:00 stderr F at Microsoft.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover, SqlAuthenticationMethod authType)
2021-01-30T21:26:12.980035159+01:00 stderr F at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
2021-01-30T21:26:12.980040736+01:00 stderr F at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
2021-01-30T21:26:12.980046285+01:00 stderr F at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
2021-01-30T21:26:12.980051461+01:00 stderr F at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken, DbConnectionPool pool)
2021-01-30T21:26:12.980057528+01:00 stderr F at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
2021-01-30T21:26:12.980061709+01:00 stderr F at Microsoft.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
2021-01-30T21:26:12.980066544+01:00 stderr F at Microsoft.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
2021-01-30T21:26:12.980084277+01:00 stderr F at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
2021-01-30T21:26:12.980088854+01:00 stderr F at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
2021-01-30T21:26:12.980093862+01:00 stderr F at Microsoft.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()
2021-01-30T21:26:12.980098807+01:00 stderr F --- End of stack trace from previous location where exception was thrown ---
2021-01-30T21:26:12.980102605+01:00 stderr F at Microsoft.Health.SqlServer.Features.Schema.SchemaInitializer.DoesDatabaseExistAsync(SqlConnection sqlConnection, String databaseName, CancellationToken cancellationToken)
2021-01-30T21:26:12.980106458+01:00 stderr F at Microsoft.Health.SqlServer.Features.Schema.SchemaInitializer.CanInitializeAsync(CancellationToken cancellationToken)
2021-01-30T21:26:12.980111196+01:00 stderr F at Microsoft.Health.SqlServer.Features.Schema.SchemaInitializer.InitializeAsync(Boolean forceIncrementalSchemaUpgrade, CancellationToken cancellationToken)
2021-01-30T21:26:12.980117559+01:00 stderr F at Microsoft.Health.SqlServer.Features.Schema.SchemaInitializer.StartAsync(CancellationToken cancellationToken)
2021-01-30T21:26:12.980123754+01:00 stderr F at Microsoft.AspNetCore.Hosting.HostedServiceExecutor.ExecuteAsync(Func`2 callback, Boolean throwOnFirstFailure)
2021-01-30T21:26:12.980142748+01:00 stderr F at Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken)
2021-01-30T21:26:12.980151637+01:00 stderr F at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
2021-01-30T21:26:12.980161216+01:00 stderr F at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
2021-01-30T21:26:12.980167288+01:00 stderr F at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
2021-01-30T21:26:12.980172955+01:00 stderr F at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
2021-01-30T21:26:12.980178578+01:00 stderr F at Microsoft.Health.Fhir.Web.Program.Main(String[] args) in /repo/src/Microsoft.Health.Fhir.Shared.Web/Program.cs:line 40
2021-01-30T21:26:12.98018441+01:00 stderr F ClientConnectionId:00000000-0000-0000-0000-000000000000

To reproduce

I was unable to provide an isolated way to reproduce it (see microsoft/fhir-server#1623 (comment) for my attempt), so it might be related to the configuration of the local SQL Server.

Expected behavior

The connection to the SQL server should succeed as it did with version 2.0.1.

Further technical details

Microsoft.Data.SqlClient version: v2.1.1
.NET target: .NET Core 3.1
SQL Server version: 14.00.3356.
Operating system: Windows Server 2019

Additional context

@JRahnama
Copy link
Contributor

JRahnama commented Feb 9, 2021

Hi @chgl thanks for brining up the issue with us. The fix to this problem has been merged with PR #874. Our next release, 2.1.2, will be in the first week of March. Feel free to test it with a fresh clone of the driver.

@JRahnama JRahnama added the 2️⃣ Duplicate Issue/PR that is a duplicate and already exists. label Feb 9, 2021
@JRahnama
Copy link
Contributor

JRahnama commented Feb 9, 2021

Closing the issue as we have other open issues related to the same topic.

@JRahnama JRahnama closed this as completed Feb 9, 2021
@chgl
Copy link
Author

chgl commented Feb 9, 2021

Ah, sorry I didn't see that one! Thank you, looking forward to testing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2️⃣ Duplicate Issue/PR that is a duplicate and already exists.
Projects
None yet
Development

No branches or pull requests

2 participants