The SQL Server instance returned an invalid or unsupported protocol version during login negotiation

Viewed 3699

I am using dotnetcore 1.1 and trying to connect to SQL server version 8.00.2055.

I have 2 connections inside project: one to SqlServer 2016 and another one to Sql Server 8.00.2055 (Sql Server 2000?)

This second connection could not be established. Here is the error I am getting:

2017-07-31T11:34:24.8747442+02:00 0HL6NUT8S82KF [ERR] User : - The SQL Server instance returned an invalid or unsupported protocol version during login negotiation. (637b11d7)

Connection String I am using is Server=MyServerHost; Initial Catalog=MyDatabaseName; User id=sa; Password=********;

Any idea how to fix this error?

2 Answers

This is an old answer, and it was originally for dotnetcore 1.1, but now with dotnetcore 2.2 released, OdbcConnection is supported, which will let you use any old Odbc drivers. So something like this will now let you connect to a SQL Server 2000 database:

            using (var conn =
                new OdbcConnection("Driver={SQL Server};Server=<YOUR_SERVER>;Database=<YOUR_DB>;Trusted_Connection=True;"))
            {
                conn.Open();
                var cmd = new OdbcCommand("SELECT * FROM SOMETABLE", conn);
                var reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var values = new Object[reader.FieldCount];
                        var fieldCount = reader.GetValues(values);

                        Console.WriteLine("Found {0} columns.",
                            fieldCount);
                        for (int i = 0; i < fieldCount; i++)
                            Console.WriteLine(values[i]);

                        Console.WriteLine();
                    }
                }
            }

There are other drivers that will work as well, not just {SQL Server}. Check out: https://www.connectionstrings.com/sql-server-2000/ for other ODBC connection strings (need to scroll down to the ODBC sections).

Related