0

Tried to connect to the Oracle database using Pyodbc:

try:
    db_connection = pyodbc.connect('DSN=OraDev; PWD=%s' % Key.dbKeys['password'])
except pyodbc.Error, err:
        print >> debug_file, "Database connection failed: %s" %err 
        sys.exit()

and it keeps giving me this error message:

'[IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application (0) (SQLDriverConnect)

So I am wondering if the culprit is that I am not having the "matching" components. Currently, I have:

  1. Python 2.7 32bit
  2. Pyodbc 3.0.6 win32-py2.7
  3. Oracle ODBC driver: 32bit
  4. Windows server 2008 64bit
  5. Oracle 11.2.0 64bit

Are there anything wrong with the versions here? Thanks.

1
  • Nowadays I would use Oracle's python-oracledb driver which has a lot more functionality than ODBC, and also doesn't need all the extra Oracle client libraries or ODBC driver manager that an ODBC installation needs. Commented May 3 at 2:37

1 Answer 1

1

The issue you are having is that 64 bit Windows does not play well with 32 bit ODBC. You can read more about it here:

The 32-bit version of the ODBC Administrator tool and the 64-bit version of the ODBC Administrator tool display both the 32-bit user DSNs and the 64-bit user DSNs in a 64-bit version of the Windows operating system.

The work around is to specifically target the ODBC driver for the architecture you are looking to implement.

A side note, trying to implement ODBC for oracle on a mixed architecture platform became a headache for us. So, we implemented access to oracle through CX_Oracle

Sign up to request clarification or add additional context in comments.

1 Comment

You need to find out whether your Oracle client is 32-bit or 64-bit. Everything must be 64-bit or everything must be 32-bit you cannot mix and match. Sometimes the 64-bit client also has 32-bit libraries but they will be in an alternative directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.