Solved

Using MFC DAO Classes using Apache Handler

Posted on 2013-05-10
6
691 Views
Last Modified: 2013-05-22
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
Comment
Question by:BeachCoder
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:mccarl
ID: 39158165
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
 
LVL 11

Expert Comment

by:datAdrenaline
ID: 39158522
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
 

Author Comment

by:BeachCoder
ID: 39159496
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Accepted Solution

by:
BeachCoder earned 0 total points
ID: 39174815
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
 

Author Closing Comment

by:BeachCoder
ID: 39186862
Workaround, not solution to problem.
0
 
LVL 11

Expert Comment

by:datAdrenaline
ID: 39187137
thanks for posting your workaround! good luck on your project!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now