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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PMH4514Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.