CM99
CM99

Reputation: 313

64bit Connection string for Access DB

Our application written in c# has both 64bit and 32bit versions that can be installed. Trying to import data from a 3rd party access db

The 32bit version will work with the connection string

Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}; Jet OLEDB:Database Password={1};"

The 64bit version will fail with the same connection string with the error

"The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine"

If i change the connection string to be

"Provider=Microsoft.ACE.OLEDB.12.0; Data Source={0}; Jet OLEDB:Database Password={1};"

the Error returned is "Cannot open a database created with a previous version of your application.'"

The workaround is to just install the 32bit version but majority of users will have 64bit installed.

Any suggestions to what is the best connection string to use for the 64bit version to connect to the access db?

Upvotes: 0

Views: 1433

Answers (1)

JonasH
JonasH

Reputation: 36596

I do not think the connection string is the problem. As far as I can tell the connection string looks fine.

To use an access database from a 64 bit application you need a 64 bit version of ace. You can get this by either

  1. Install the 64 bit version of access/office
  2. Install the 64 bit version of "Microsoft Access Database Engine Redistributable"

I think you can install the redistributable package side by side with office, but it was a few years ago I was messing around with this. Note that you can use the ace engine for both 32 and 64 bit builds, as long as the corresponding redistributable is installed.

That said, I would really recommend moving to some other kind of database. I have had no end of issues with access, the performance have never been good, there is the 2Gb limit on older versions, and I had some random crashes that I never managed to solve. It is perfectly possible to migrate data transparently to something else. SQLite seem to be the most popular alternative for a small in-process database.

Upvotes: 0

Related Questions