Search code examples
rpython-3.xodbcpyodbcrodbc

pyodbc cannot connect whereas similar connection works with RODBC


I try to connect to my DB with the following request:

import pyodbc
connectionString = "driver={Adaptive Server Enterprise};database=#DB#;Server=#Server#;port=#port#;UID=#UID#;PWD=#PWD#;"

pyodbc.connect(connectionString)

However I get the following error, as if my connection string is not correct:

Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

Which is strange, since I managed to connect to my DB in R with ROBC module.

library(RODBC)
ch = odbcDriverConnect(connection = connectionString)

Any idea what is wrong with my connection string in pyodbc ?


Solution

  • I resolved my problem, the request is working with 32-bits python interpreter. It appears not to be 64bits compatible.

    Similar topic here: cannot connect to 64bit MsAccess database with 64bit Python 3.6.ODBC Driver Error