Pyodbc error when trying to connect to DB

409 Views Asked by At

I'm trying to connect to a DB using pyodbc.

This is my code:

import pyodbc as db
c_str = r'DRIVER={InterSystems ODBC35}; ' + 'SERVER={0}; PORT={1}; DATABASE={2};' \
                                              'UID={3}; PWD={4}; SQL_ACCESS_MODE=1'.format(
                                               server, port, database, user, pw)
    conn = db.connect(c_str, autocommit=True)

But I keep getting this error below in the traceback:

pyodbc.Error: ('HY000', '[HY000] [Cache ODBC][State : HY000][Native Code 417]\r\n[C:\\Program Files\\Anaconda3\\pythonw.exe]\r\nAccess Denied (417) (SQLDriverConnect); [HY000] [Cache ODBC][State : HY000][Native Code 417]\r\n[C:\\Program Files\\Anaconda3\\pythonw.exe]\r\nAccess Denied (417)')

Does anyone know what needs to be done? I've configured the DSN and the connection test was fine.

0

There are 0 best solutions below