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
Have also installed the Microsoft ODBC Server 2017 Driver for Linux (version: Ubuntu 18.10)
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
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