Search code examples
sqlubuntusqlcmd

sqlcmd not able to find a library (libmsodbcsql-17.0.so.1.1) that is there


I'm on Ubuntu 16.04 trying to use sqlcmd launched programmatically from a script to do a SQL query in the VM's cloud.

vm-dev:~$ sudo sqlcmd -S my-db.url.net -d my-db

I keep getting this error:

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.0.so.1.1' : file not found.

But the file is clearly there:

vm-dev:~$ ls /opt/microsoft/msodbcsql17/lib64/

libmsodbcsql-17.0.so.1.1


Solution

  • I have same problem, this solution worked for me: you have to downgrade the msodbcsql version,

    1. apt-get remove msodbcsql
    2. apt-cache madison msodbcsql
    3. apt-get install msodbcsql=13.1.9.2-1
    4. apt-cache madison mssql-tools
    5. ACCEPT_EULA=Y apt-get install mssql-tools=14.0.6.0-1
    6. apt-mark hold mssql-tools
    7. apt-mark hold msodbcsql

    I got this solution from this link:

    https://github.com/Microsoft/msphpsql/issues/684