The 'Microsoft.Ace.Oledb.12.0' Provider Is Not Registered on the Local MAChine While Data Export to Ms Access

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

Well, you need to install it. You're looking for:

  • The 2007 Office System Driver: Data Connectivity Components.

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine while data export to MS ACCESS

The reference to the Access Interop bits has nothing to do with your exception and Access Interop is not necessary to use the classes in the System.Data.OleDb.

The problem arises when you have your application compiled for AnyCPU Platform, you are running on a 64bit system and the installed ADO.NET provider (Microsoft ACE.OLEDB.12.0) is the 32bit version.

When using the AnyCpu target Platform your code will be executed as 64bit code on 64bit systems and as 32bit code on 32bit systems. An application executed as 64bit cannot use 32bit drivers (and viceversa). Now add to the mix the fact that Microsoft.ACE.OLEDB.12.0 has two different versions. One for 64bit and and one for 32bit and they cannot be installed together on the same machine.

The simplest workaround is to change the Target Platform of your application through Visual Studio menu

 BUILD -> Configuration Manager -> Active Solution Platform -> x86

If the x86 option is not already there, then select NEW, name it x86, Copy Settings from AnyCPU and check Create new project platforms

If you think that using a 32bit app on a 64bit Operating System is a loss of performance or something to be avoided then think twice and read this reference where the PRO and CONS of AnyCpu are critically examined. If you don't have a specific reason to use AnyCpu it is better to stay with x86.

Of course, another option is to deinstall the 32bit version and install the 64bit version of ACE from here and then run you application as AnyCpu on 64bit systems. But this could be a nightmare for your deployment scenarios. What if Microsoft Office 32bit version is installed on your x64 target machine? Office installs its bit compatible version of ACE and, as said, it is not possible to have 32bit and 64bit of ACE installed on the same machine.

Now you should also ask your customer to reinstall Office as 64bit to keep your 64bit app happy.

UPDATE


The situation has changed a bit with the newest versions of Visual Studio. There is now a new option that is the default for new projects. It is called AnyCPU Prefer 32bit mode. More details at this link: What AnyCPU Really Means As Of .NET 4.5 and Visual Studio 11 and another interesting post (albeit regarding Sql Server Compact) is this one The trouble with Any CPU–Prefer 32 bit–BadImageFormatException

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine (server)

It's probably a bitness issue, but it's not about the bitness in your Build properties.

The ACE driver is available in two versions: x86 and x64.

  1. You can only install one of them.
  2. If you install the x86 version, only x86 applications can use it. If you install the x64 version, only x64 applications can use it. (Yes, it's stupid.)

Now, whether your web application runs in x86 (32-bit) or x64 mode is not determined by your build settings but by the settings of your application pool: Select the application pool in IIS Manager, go to Properties/Advanced Settings and verify the setting of Enable 32-bit Applications. If it is set, your application runs in x86 mode, otherwise in x64 mode. Make sure it is the same mode as the one of which you installed the ACE driver.

(Of course, Steve's answer about using the right driver name also applies.)

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine Error in importing process of xlsx to a sql server

Install the following to resolve your error.

2007 Office System Driver: Data Connectivity Components

AccessDatabaseEngine.exe (25.3 MB)

This download will install a set of components that facilitate the
transfer of data between existing Microsoft Office files such as
Microsoft Office Access 2007 (*.mdb and .accdb) files and Microsoft
Office Excel 2007 (
.xls, *.xlsx, and *.xlsb) files to other data
sources such as Microsoft SQL Server
.



Related Topics



Leave a reply



Submit