Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP ODBC connect() to Access - architecture mismatch

I have googled for hours now.

I have read countless articles such as: Is there a Windows 7 ODBC driver for Access?

I have tried using both the ODBC admin - and have managed to successfully add there system DSN for both:

  • Microsoft Access Database
  • Microsoft do Access Database

When I attempt to connect to Access DB stored locally:

odbc_connect('Aquarius2', '', '');

I get the following error(s):

odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application, SQL state IM014 in SQLConnect in C:\export\export.php on line 3

Simple script tried installing the latest access drivers - Aquarius2 is the name of my DSN still fails.

I'm out of ideas - what am I missing?

Regards, Alex

like image 523
Alex.Barylski Avatar asked Feb 09 '12 22:02

Alex.Barylski


People also ask

How do you fix the specified DSN contains an architecture mismatch between the driver and application?

Recommendation: Remove the 64 bit ODBC connection and then create a new 32 bit ODBC by running c:\windows\sysWOW64\odbcad32.exe rather than by clicking the ODBC Applet in the Control Panel.

How do I use 32 bit ODBC on 64 bit?

If you build and then run an application as a 32-bit application on a 64-bit operating system, you must create the ODBC data source by using the ODBC Administrator tool in %windir%\SysWOW64\odbcad32 .exe. To indicate the type of DSN, you can add '_32' to the 32-bit user DSNs and '_64' to the 64-bit user DSNs.

What is ODBC in SQL Server?

ODBC is the primary native data access API for applications written in C and C++ for SQL Server. There's an ODBC driver for most data sources. Other languages that can use ODBC include COBOL, Perl, PHP, and Python. ODBC is widely used in data integration scenarios.


1 Answers

You are attempting to use a 64 bit application with a 32 bit ODBC driver or vice versa. Look at ODBC on 64-bit Windows Platforms.

You need to determine whether your PHP application is 64 bit or 32 bit first.

Then once you've ascertained that you need to start the correct ODBC administrator - there are 2 of them, one for 32 bit and one for 64 bit. The 64 bit ODBC administrator is in Adminstrative tools, control panel and the 32 bit one is in %windir\syswow64\odbcad32.exe.

Once you've matched your application architecture to the right ODBC administrator, you need to create the system DSN. If you cannot find the MS Access driver in the administrator, you'll need to download one for that architecture. I'm not sure if there is a 64 bit MS Access ODBC driver; if there isn't, you'll have to change your application architecture.

The article I referenced has more information.

like image 200
bohica Avatar answered Oct 15 '22 09:10

bohica