Solved

Using MFC DAO Classes using Apache Handler

Posted on 2013-05-10
6
695 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ignore other .htaccess 2 44
Access 2003 query lost it's only join 7 26
update all email addresses SQL 1 23
Field naming convntions - MS Access 7 24
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

776 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