Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making a connection with MS Access

Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

and

Microsoft.JET.OLEDB.4.0' provider is not registered on the local machine.

are both errors for me. I've been trying both while trying to create an Access connection. I'm not sure what to do anymore.

I have 32 bit office on a 64 bit machine. I found solutions where they said to install the Access Database Engine but it won't let me install 64 bit with 32 bit office. Another source mentioned to bypass this you can go into command line and do $> AccessDatabaseEngine_X64.exe /passive but passive isn't recognized as a command.

I found another potential solution which said to download Office system driver and components then add the access database as a source but that didn't work either. I'm running out of ideas it would be greatly appreciated if someone could help.

Links to articles I'm referring to:

  • Microsoft.ACE.OLEDB.12.0 provider is not registered
  • http://blog.codefluententities.com/2011/01/20/microsoft-access-database-engine-2010-redistributable/
like image 614
John Smith Avatar asked Nov 02 '22 11:11

John Smith


1 Answers

If you already have 32-bit Office installed then you're pretty much stuck with the 32-bit version of the Access Database Engine (a.k.a. "ACE"). As you have found, there is supposedly a way to force 64-bit ACE onto a machine that already has 32-bit Office components on it, but personally I wouldn't "go there".

So, you need to configure your C# project to run as 32-bit. You can do that by choosing Platform: x86 on the Build tab of the project's Properties:

Platform.png

(That screenshot was taken on a 32-bit virtual machine, so the default configuration was already 32-bit. The default setting on 64-bit machines should be "Any CPU".)

To verify the environment in which the process is running you can use

String.Format("I am running as {0}-bit.", IntPtr.Size * 8)

For example, in a Windows Forms application you could use

MessageBox.Show(String.Format("I am running as {0}-bit.", IntPtr.Size * 8));

That should display

I am running as 32-bit.
like image 120
Gord Thompson Avatar answered Nov 15 '22 04:11

Gord Thompson