unixODBC Driver Manager SQL Server Error

1

I have the error below when running a script to connect to an instance of MSSQL.

I am using Ubuntu Disco Dingo (development branch) 19.04.

None of the below issues are encountered on Ubuntu 18.04.02. However, I'd like to try to make it work in the new Ubuntu version.

I have an install of Azure Data Studio v1.5.2 dated Mar 22, 2019

Azure Data Studio v 1.5.2

Have also installed the Microsoft ODBC Server 2017 Driver for Linux (version: Ubuntu 18.10)

ODBC Driver 17 for SQL Server

I have verified that my driver exists in the path:

/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1

I have run odbcinst -j with the following output:

unixODBC 2.3.7
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/leeca/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

However, I have an odbcinst.ini file in two locations.

Location 1:

/opt/microsoft/msodbcsql17/etc/odbcinst.ini

nano odbcinst.ini:

[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1

Location 2:

/etc/odbcinst.ini

nano odbcinst.ini:

[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1
UsageCount=1

I have tried to navigate to /opt/microsoft/msodbcsql17/etc to symlink the file in /etc/odbcinst.ini by running ln -s /etc/odbcinst.ini but it fails with the error: ln: failed to create symbolic link 'etc/odbcinst.ini': File exists

Connecting to the SQL Server Instance in JupyterLab using this script:

class Database():
    def __init__(self):
        self.cnxn = pyodbc.connect(driver='{ODBC Driver 17 for SQL Server}',
                                   server='servername',
                                   database=dbname,
                                   uid=user,
                                   pwd=password)

yields the error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1' : file not found (0) (SQLDriverConnect)")

Connecting to the SQL Server Instance using Azure Data Studio yields the error:

Extension host terminated unexpectedly.

Folder path permissions:

 drwxr-xr-x /
 drwxrwxr-x opt
 drwxr-xr-x microsoft
 drwxr-xr-x msodbcsql17
 drwxr-xr-x lib64
 -rwxr-xr-x libmsodbcsql-17.3.so.1.1

f: /etc/
 drwxr-xr-x /
 drwxr-xr-x etc

Any help would be appreciated, many thanks

yongsheng

Posted 2019-04-15T00:15:11.647

Reputation: 13

Amazing.. unfortunately I do not have enough reputation to upvote but yours is the correct solution. Saved me countless hours of frustration.. thank you sir!! – yongsheng – 2019-05-01T03:04:31.760

Answers

2

I had this exact error on Ubuntu 19.04 yesterday & today, and thought I might be able to help, after hours of frustration.

I used the command "ldd /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1", and found that libssl1.0.0 was not found.

Unfortunately, I did not have a suitable candidate replacement available within Ubuntu 19.04 Disco's repository. I was able to download the .deb directly from this resource: https://packages.ubuntu.com/cosmic/amd64/libssl1.0.0/download, and that solved my issue.

Sean Halls

Posted 2019-04-15T00:15:11.647

Reputation: 36

2You saved my life – Saeed Vaziry – 2019-07-03T16:09:01.073

I recently ran into another issue when re-installing with SQL Server 2019. Following the instructions this post may be helpful to people so I thought I'd put it here just in case: https://stackoverflow.com/a/57453901/1961551

– Sean Halls – 2019-09-28T01:22:08.043