CDatabase - open file without ODBC setting?


I have an MFC application that uses an MS Access database configured via ODBC.

I use CDatabase, and call OpenEx(..) passing to it the connection string which specifies the name of the ODBC entry.. All standard stuff, works just fine.

I am working on an import utility (runs without user interaction) and need to be able to create a CDatabase instance, but instead of using an ODBC entry, I have a specified path to an Access MDB file.  

How can I create this connection to a specified MS Access file without having to modify or create an ODBC setting? (note I mentioned this utility runs without user interaction, so not specifying a connection and prompting a "locate data source" dialog is not appropriate.)

Who is Participating?
alb66Connect With a Mentor Commented:
You can use CDaoDatabase class instead of CDatabase.
CDaoDatabase make use of the access jet engine instead of ODBC drivers, so is specific for access mdb database.
PMH4514Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.