ODBC Connection to SQL Server 2019 fails on Linux

John Pyrce 96 Reputation points
2020-09-16T23:27:58.26+00:00

I have an existing program that queries SQL Server 2019 that works on Windows. I'm porting it to Red Hat Linux. The program and SQL Server are both running on Linux. The initial connection fails with this logged message:

[ODBC][26780][1600288782.613701][SQLFreeHandle.c][220]
Entry:
Handle Type = 1
Input Handle = 0x7ffff08253f0
DIAG [08001] [Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:80001044:lib(128):func(1):internal error:unexpected error]

DIAG [08001] [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection

The connection also logged this information:

[ODBC][26780][1600288782.211533][SQLDriverConnect.c][748]
Entry:
Connection = 0x7ffff00a1740
Window Hdl = (nil)
Str In = [DRIVER={ODBC Driver 17 for SQL Server};SERVER=localhost;APP=DbProtect Sensor for Microsoft SQL Server;DATABASE=master;Uid=sa;Pwd...][length = 146]
Str Out = 0x7ffff673ecf0
Str Out Max = 255
Str Out Ptr = 0x7ffff673ee1e
Completion = 0
UNICODE Using encoding ASCII 'ANSI_X3.4-1968' and UNICODE 'UTF16LE'

What could be causing the cryptic error:80001044 from the SSL provider?

SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. John Pyrce 96 Reputation points
    2020-11-04T17:15:54.793+00:00

    I tried the above suggestions to no benefit.

    After quite a bit of investigation, I did find the problem: the MS ODBC driver on RHEL7 uses the RHEL SSL 1.0 library via a shared library, and my application statically links to a SSL 1.1 library. These two versions have a different API. So, the two libraries conflict. This is presumably the source of the cryptic error.

    This problem occurred on RHEL7. I can work around this by requiring RHEL8, where the SSL library is 1.1 and is consistent. This does work.

    It would have been helpful if the Microsoft ODBC driver provided an informative error message rather than what is listed above. Perhaps the numeric code means something, but I couldn't find a definition of it. "Internal error" is similarly uninformative. A more detailed error message would have saved significant effort.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. CathyJi-MSFT 22,396 Reputation points Microsoft External Staff
    2020-09-17T07:43:03.723+00:00

    Hi @John Pyrce ,

    Did you apply the latest CU7 for SQL server 2019? You can get it from here.

    Please try to follow the steps from MS document Troubleshoot SQL Server on Linux to resolve your issue.

    Hope this could help you.

    Best regards,
    Cathy


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.