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

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

Closed
jasperdunn opened this issue Apr 27, 2018 · 8 comments
Closed

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

jasperdunn opened this issue Apr 27, 2018 · 8 comments
Labels

Comments

@jasperdunn
Copy link

  • 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.

@jasperdunn
Copy link
Author

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

@MattIrv
Copy link
Contributor

MattIrv commented May 1, 2018

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.

@MattIrv
Copy link
Contributor

MattIrv commented Jun 29, 2018

@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!

@jasperdunn
Copy link
Author

jasperdunn commented Jun 29, 2018

@MattIrv Fantastic!

@schadilibre
Copy link

Now it works fine for me with 1.4.0 ! Thanks a lot ! 👍

@avermaet
Copy link

avermaet commented Jun 8, 2019

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

@fcabalfiera
Copy link

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!

@abist abist closed this as completed Nov 7, 2019
@rockycookie
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants