There are two different modules which you might be using to connect to an SQL Server database.
The odbc module is very basic, written in C, and follows the db-api version 1 api. The adodbapi module is more complex, written in Python, and follows the db-api version 2 specification (PEP 249, with many proposed "version 3" extensions). Unfortunately, due to my error, some parts of adodbapi are missing from the current release of pywin32, so you must install adodbapi separately from http://sourceforge.net/projects/adodbapi or from pypi <https://pypi.python.org/pypi/adodbapi/2.6.0.7>. The separate download gives you more examples and documentation, and is necessary for Linux and IronPython users. Other than that, all pywin32 extensions are loaded together, if you have anything, you should have everything. Assuming that you are using a recent version of adodbapi... > >>> from adodbapi import is64bit > >>> is64bit.Python() > True > >>> is64bit.os() > True > >>> > I added these two functions as an aid for a programmer who is trying to automatically determine a working connection string, since 32 bit and 64 bit versions use different drivers. This is briefly discussed in the documentation, and complex working examples can be found in the test directory. A copy of the documentation is also at http://adodbapi.sourceforge.net/quick_reference.pdf. After a connection to the database has been established, you can determine the database engine and version you have been connected to... > import adodbapi > import adodbapi.is64bit as is64bit > > databasename = "test.mdb" > > if is64bit.Python(): > driver = "Microsoft.ACE.OLEDB.12.0" > else: > driver = "Microsoft.Jet.OLEDB.4.0" > constr = "Provider=%s;Data Source=%s" % (driver, databasename) > > #create the connection > con = adodbapi.connect(constr) > > print('dbms_name=', con.dbms_name, ' dbms_version=', con.dbms_version) > The above code is untested. I just "upgraded" to Windows 10, and it seems that the ACE driver is now broken. YMMV. -- Vernon Cole On Wed, Sep 2, 2015 at 10:14 AM, Robin Becker <ro...@reportlab.com> wrote: > A user reports the following error > > dbi.internalError: [Microsoft][ODBC Driver Manager] The specified DSN > contains > an architecture mismatch between the Driver and Application in LOGIN. > > trying to connect to a new database source because they migrated the > windows server to a new machine with a supported windows version. > Apparently the sql server version changed from SQL Server version 2005 to > 2012. > > The client machine is 64 bit with python 2.7, I am trying to determine the > version of python +32/64 etc etc and the win32 extensions that are > installed. > > Has anyone any advice on what the problem is here? > -- > Robin Becker > _______________________________________________ > python-win32 mailing list > python-win32@python.org > https://mail.python.org/mailman/listinfo/python-win32 >
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32