I am having an issue getting sql server odbc driver to work in a docker image. The details are below:
OS Info
NAME="Rocky Linux"
VERSION="8.4 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel fedora"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.4 (Green Obsidian)"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:rocky:rocky:8.4:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky Linux"
ROCKY_SUPPORT_PRODUCT_VERSION="8"
i have added the odbc trace option in the odbinst.ini file. The full error:
ODBC Trace
[ODBC][31][1642685080.665980][__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x561eac6f9b80
[ODBC][31][1642685080.666012][SQLAllocHandle.c][377]
Entry:
Handle Type = 2
Input Handle = 0x561eac6f9b80
UNICODE Using encoding ASCII 'ANSI_X3.4-1968' and UNICODE 'UCS-2LE'
[ODBC][31][1642685080.666215][SQLAllocHandle.c][513]
Exit:[SQL_SUCCESS]
Output Handle = 0x561eac700050
[ODBC][31][1642685080.666236][SQLDriverConnect.c][748]
Entry:
Connection = 0x561eac700050
Window Hdl = (nil)
Str In = [DRIVER={ODBC Driver 17 for SQL Server};server=TSVMAEPHQDB019;UID=SubSitesDataRead;PWD=**********][length = 96 (SQL _NTS)]
Str Out = 0x7ffded5a5620
Str Out Max = 2048
Str Out Ptr = (nil)
Completion = 0
[ODBC][31][1642685080.669342][SQLConnect.c][1140]Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.8.so.1.2' : file not found
[ODBC][31][1642685080.669379][SQLError.c][424]
Entry:
Connection = 0x561eac700050
SQLState = 0x7ffded5a9c36
Native = 0x7ffded5a9c30
Message Text = 0x7ffded5a9c40
Buffer Length = 500
Text Len Ptr = 0x7ffded5a9c2e
[ODBC][31][1642685080.669414][SQLError.c][474]
Exit:[SQL_SUCCESS]
SQLState = 01000
Native = 0x7ffded5a9c30 -> 0 (32 bits)
Message Text = [[unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.8.so.1.2' : file not found]
[01000][unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.8.so.1.2' : file not found
[ODBC][31][1642685080.669438][SQLError.c][424]
Entry:
Connection = 0x561eac700050
SQLState = 0x7ffded5a9c36
Native = 0x7ffded5a9c30
Message Text = 0x7ffded5a9c40
Buffer Length = 500
Text Len Ptr = 0x7ffded5a9c2e
[ODBC][31][1642685080.669461][SQLError.c][474]
Exit:[SQL_NO_DATA]
[ODBC][31][1642685080.669476][SQLError.c][424]
Entry:
Environment = 0x561eac6f9b80
SQLState = 0x7ffded5a9c36
Native = 0x7ffded5a9c30
Message Text = 0x7ffded5a9c40
Buffer Length = 500
Text Len Ptr = 0x7ffded5a9c2e
[ODBC][31][1642685080.669501][SQLError.c][474]
Exit:[SQL_NO_DATA]
[ISQL]ERROR: Could not SQLDriverConnect
[ODBC][31][1642685080.669524][SQLFreeHandle.c][290]
Entry:
Handle Type = 2
Input Handle = 0x561eac700050
[ODBC][31][1642685080.669553][SQLFreeHandle.c][339]
Exit:[SQL_SUCCESS]
[ODBC][31][1642685080.669569][SQLFreeHandle.c][220]
Entry:
Handle Type = 1
Input Handle = 0x561eac6f9b80
Some important notes:
1) i have followed microsofts exact instructions, uninstalling unixODBC before installing: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15#debian17
2) i ran chmod 777 -R to verify there was no permissions issues on the driver / path
3) verified the path to the driver is correct and the driver's name is correct.
odbcinst.ini file below:
[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.8.so.1.2
UsageCount=1
[ODBC]
Trace=Yes
TraceFile=/dev/stdout
Well... that went a lot more quickly than I expected. It looks like the
mssql-tools
package should depend uponlibssh-4
.However, I just noticed that you're running Rocky Linux, whereas I'm running Ubuntu. I suspect that the same dependency is missing in both cases, but we'll still need to confirm this.
After further digging, it looks like
libssh-4
pulls inlibgssapi-krb5-2
. So, the dependency that's actually missing islibgssapi-krb5-2
.FYI: You can also confirm this by running the
ldd
command: