Link to home
Start Free TrialLog in
Avatar of BeachCoder
BeachCoder

asked on

Using MFC DAO Classes using Apache Handler

I am trying to access an Access Database using an Apache handler.

I have written a C++ Console App based on MFC that uses DAO classes to access an Access database on a Windows 7 64 system.  It works as expected when I launch in it a cmd window

I have Apache running on this computer,  with the same login credentials when running the console.

When I attempt to run the program in Apache I get the error:  Unable to initialize DAO/Jet db Engine.  If I comment out the line to open the database, the program works and it's console output is displayed in the browser window.

I have checked that I am running Apache and the Program under the same user.  I have checked that I am setting the correct DAO version (3.6).   I have checked and installed DAO360, registered it.

Somehow, when Apache attempts to launch the program, something is preventing the DB drivers from loading, but when I launch the same program in a console window, no problem.
Avatar of mccarl
mccarl
Flag of Australia image

Is the Access DB specified as a filename or a DSN? If a filename, are you using absolute paths or are you making sure the current directory is set correctly?
DAO 3.6 and the Jet database engine are only compatible with 32 bit applications.  it is my suspision that when running from the command prompt, you are at 32bit, but in Apache, you are at 64bit.

you may want to consider installing the ACE 12 (A2007) database engine to handle 32 bit, then install ACE 14 (Access 2010)/64bit database engine for your 64 bit needs.  then you can use Microsoft Office Access database engine objects (which is DAO vNext).

please note I am talking about the database engine installation only not the full blown versions of access.
Avatar of BeachCoder
BeachCoder

ASKER

mccarl - The error occurs attempting to construct the MFC DAO interface, the program never gets to the point where a specific database is opened.

datAdrenaline: I am running the standard Apache binaries (which are 32-bit, I don't think they are available from Apache in 64-bit yet).  I will try installing the different ACE database engines and see if that makes a difference.  

As an aside, when doing research I came across a post when the ODBC drivers are being incorrectly pulled from system32, and not sysWOW64.  There probably is some mixing of 32/64/:  (Ignore the microsoft responses as not-helpful).

http://answers.microsoft.com/en-us/windows/forum/windows_7-hardware/odbc-drivers-missing-in-windows-7-home-premium-64/56139d24-f903-43ff-8f3e-363e467795a6
ASKER CERTIFIED SOLUTION
Avatar of BeachCoder
BeachCoder

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Workaround, not solution to problem.
thanks for posting your workaround! good luck on your project!