Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 713
  • Last Modified:

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.
0
BeachCoder
Asked:
BeachCoder
  • 3
  • 2
1 Solution
 
mccarlIT Business Systems Analyst / Software DeveloperCommented:
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?
0
 
datAdrenalineCommented:
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.
0
 
BeachCoderAuthor Commented:
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
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
BeachCoderAuthor Commented:
I tried a clean install using Windows 7 32-bit to see if it was a 32/64 conflict, but the same behavior:  Works fine in a console window, but when attempting to launch through Apache get error Unable to initialize DAO/Jet DB Engine.  Apache is running under the same user as the logged in user.

The best solution was to rewrite the routines moving away from DAO (CDaoWorkspace) and towards ODBC (CDatabase).  Seems to work fine under the ODBC drivers.  To use the ODBC drivers, need to use the ODBC Drivers Missing on 64 bit windows link above to configure them correctly.
0
 
BeachCoderAuthor Commented:
Workaround, not solution to problem.
0
 
datAdrenalineCommented:
thanks for posting your workaround! good luck on your project!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now