microsoft/vscode-mssql

Failed to connect - error occurred during pre-login handshake.

jasperdunn opened this issue ยท 8 comments

  • MSSQL Extension Version: 1.3.1
  • VSCode Version: 1.22.2
  • OS Version: macOS 10.13.4

I'm trying to connect to my database on AWS RDS. Since I've updated to 10.13.4 I haven't been able to connect to it.

Error message:
A connection was successfully established with the server, but then an error occurred during the pre-login handshake.

I can connect to the database via terminal. So it's not macOS that is causing the issue.

Thanks for reporting this. The issue happens because of a bug with .Net Core 2.0 which is fixed in 2.1, so we'll need to publish an update with 2.1 soon.

For more info see our discussion about the same issue in SQL Operations Studio.

Unfortunately I don't have a workaround for you @jasperdunn, but you could try using SQL Operations Studio in the meantime since we've already fixed the bug there.

@jasperdunn if you still need this functionality, try updating to 1.4.0 which we released yesterday. Some users have reported similar errors with .NET Core 2.1, which the new update uses, but it should fix it for most.

Thanks!

@MattIrv Fantastic!

Now it works fine for me with 1.4.0 ! Thanks a lot ! ๐Ÿ‘

Was there a solution to this, or just updating to the latest version? Because I am running latest versions of both, VS-Code as well as the extension and still have this error.

mssql: Failed to connect: System.Data.SqlClient.SqlException: A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 2 - Connection was terminated)

at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection.ReliableSqlConnection.<>c__DisplayClass28_0.<<OpenAsync>b__0>d.MoveNext() in /Users/jenkins/jenkins/workspace/sqltoolsservice-mac_master/src/Microsoft.SqlTools.ServiceLayer/Connection/ReliableConnection/ReliableSqlConnection.cs:line 296 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.SqlTools.ServiceLayer.Connection.ConnectionService.<TryOpenConnection>d__29.MoveNext() in /Users/jenkins/jenkins/workspace/sqltoolsservice-mac_master/src/Microsoft.SqlTools.ServiceLayer/Connection/ConnectionService.cs:line 355 ClientConnectionId:f72e1778-5d56-44e0-9d46-c8f35653b5b0

You can set TLS 1.0 to fix this.

Also , this problem can be related to a firewall in the middle that is doing SSL inspection.

I Suggest you either try again using another connection not doing SSL inspection, or ask your firewall admin to create an exemption for the source and/or destination you are connecting to,

Cheers!

Hi I am getting this error with vscode 1.46.0 and MSSQL Extension Version: 1.9.0, when trying to connect a PostgreSQL in a docker container.

I can run psql to connect to the database, so the container should be set up correctly.

A screenshot of the error I got is attached below:

Screen Shot 2020-06-16 at 1 53 10 AM