[c#] Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine

I created a windows application developed in .NET 3.5 in a 32 bit Windows 2008 server. When deployed the application in a 64 bit server it shows the error "Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine ".

So as a solution to this issue, i have changed the build property of the project to X86, so that it will build in 32 bit mode, and rebuild the project in the 32bit machine. But, the same project uses other DB drivers (DB2, SQL etc.) to connect to other databases. So when i deployed my app again in the 64 bit OS, it throws the exception " Attempted to load a 64-bit assembly on a 32-bit platform. "

I am using the Microsoft.Jet.OLEDB.4.0 driver to read and write to the Excel (.xls)

This question is related to c# .net oledb 32bit-64bit jet

The answer is


I ran into this issue with my desktop application ('Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine). I did not have the option to build as a 32 bit app. Hoping this would help others in the same situation.

I did the following and the issue went away:

  1. Installed the 64 bit version of Microsoft Access Database Engine 2010 Redistributable, as suggested by neo

  2. Changed my provider to Microsoft.ACE.OLEDB.12.0


go to Start->Run and type cmd this starts the Command Prompt (also available from Start->Programs->Accessories->Command Prompt)

type cd .. and press return type cd .. and press return again (keep doing this until the prompt shows :> )

now you need to go to a special folder which might be c:\windows\system32 or it might be c:\winnt\system32 or it might be c:\windows\sysWOW64 try typing each of these eg cd c:\windows\sysWOW64 (if it says The system cannot find the path specified, try the next one) cd c:\windows\system32 cd c:\winnt\system32 when one of those doesn't cause an error, stop, you've found the correct folder.

now you need to register the OLE DB 4.0 DLLs by typing these commands and pressing return after each

regsvr32 Msjetoledb40.dll regsvr32 Msjet40.dll regsvr32 Mswstr10.dll regsvr32 Msjter40.dll regsvr32 Msjint40.dll


I've the same message, I have a webpage with do on visual studio 2010, I read a file.xls on that page,in my project visual has not any problem, when I put it on my IIS local throw me a 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine' ,I fixed that problem next following this steps,

1.-Open IIS
2.-Change the appPool on Advanced Settings
3.-true to enable to 32-bit application.

and that's all

ps.I changed Configuration Manager to X86 on Active Solution Platform


If the issue persist in ASP.NET,All I had to do was change the "Enable 32-bit Applications" setting to True, in the Advanced Settings for the Application Pool.


I'm using VS2013 for Winforms, the below solution worked for me.


Change in IIS Settings application pool advanced settings.Enable 32 bit application


I know that I have this problem over and over when I deploy my application on a new server because I'm using this driver to connect to a Excel file. So here it is what I'm doing lately.

There's a Windows Server 2008 R2, I install the Access drivers for a x64 bit machine and I get rid of this message, which makes me very happy just to bump into another.

This one here below works splendidly on my dev machine but on server gives me an error even after installing the latest ODBC drivers, which I think this is the problem, but this is how I solved it.

private const string OledbProviderString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\OlsonWindows.xls;Extended Properties=\"Excel 8.0;HDR=YES\"";

I replace with the new provider like this below:

private const string OledbProviderString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\OlsonWindows.xlsx;Extended Properties='Excel 12.0;HDR=YES;';";

But as I do this, there's one thing you should notice. Using the .xlsx file extension and Excel version is 12.0.

After I get into this error message Error: "Could Not Find Installable ISAM", I decide to change the things a little bit like below:

private const string OledbProviderString =      @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\OlsonWindows.xls;Extended Properties='Excel 8.0;HDR=YES;';"; 

and yes, I'm done with that nasty thing, but here I got another message The Microsoft Access database engine cannot open or write to the file 'time_zone'. It is already opened exclusively by another user, or you need permission to view and write its data. which tells me I'm not far away from solving it.

Maybe there's another process that opened the file meanwhile and all that I have to do is a restart and all will take start smoothly running as expected.


Although a more optimal solution is to simply recompile as suggested above, that requires access to the source code. In my case, I only had the finished .exe and had to use this solution. It uses CorFlags.exe from the .Net SDK to change the loading characteristics of the application.

  1. Download the .Net Framework SDK (I personally used 3.5, but the version used should be at or above the required .Net for your application.
  2. When installing, all you need is CorLibs.exe, so just check Windows Development Tools.
  3. After installation, find your CorFlags.exe. For my install of the .Net Framework 3.5 SDK, it was at C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin.
  4. Open a command prompt and type path/to/CorFlags.exe path/to/your/exeFile.exe /32Bit+.

You're done! This sets the starting flags for your program so that it starts in 32 bit WOW64 mode, and can therefore access microsoft.jet.oledb.4.0.


If your application runs on localIIS, You can solve this problem by enabling 32-bit applications in AppPool's Advanced Settings

enter image description here


There isn't a 64 bit provider for Jet. If you want to support multiple DB sources including Jet to Excel you will need at least that part of your application to run in a 32 bit process.

The error you are getting when you compile for x86 is a bit strange. I can't see how you would end up referencing 64 bit assemblies in this case.


Just Change the property based on your machine and all have done :-)

Project---> Properties--->Build--->Target Framework---> X64

or

Project---> Properties--->Build--->Target Framework---> X86


I know it's quite old questions and many persons has answered. but I am summarizing the things for understanding:

If the file extension is xls and OS is 32 bit then only you can use "Microsoft.Jet.OLEDB.4.0". Microsoft has not released 64 bit version of this driver.

If file extension is xlsx or OS is 64 bit then you must have to use "Microsoft.ACE.OLEDB.12.0". The application compiled in 32/64 bit mode does not impact the selection of driver.

Always install the 64 bit driver of Microsoft.ACE.OLEDB.12.0 on OS 64 bit. If you have already installed Office 32 bit then you need to run driver from cmd with /passive argument. This hack works till Office 2013 only, Microsoft stopped this workaround from Office 2016 for Microsoft.ACE.OLEDB.16.0 drivers.

AccessDatabaseEngine_x64.exe /passive

Download drivers Microsoft.ACE.OLEDB.12.0

private void ProcessFile(string path)
{
    string connString = string.Empty;

    if (Path.GetExtension(path).ToLower().Trim() == ".xls" && Environment.Is64BitOperatingSystem == false)
        connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
    else
        connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
}

If Application is compiled with AnyCPU flag, it will look for 64 bit Access drivers on 64 bit OS and 32 bit access drivers on 32 bit OS.


I was getting same exception while running "SQL Server 2014 Import and Export Data (64-bit)" on my Windows 8.1.

To fix the issue this issue I have done the following

started SQL Server 2014 Import and Export Data (32-bit) instead of 64-bit and it is working for me. I haven't changed any IIS setting and not installed any extra software.


I have the same problem

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

I applied the answer by neo but it did not work until I change the provider to “Provider=Microsoft.ACE.OLEDB.12.0;” in connection string.

Hope this will help if some one face the same issue.


I just Changed my Property of project into x64 format

Project---> Properties--->Build--->Target Framework---> X64


There is indeed no 64 bit version of Jet - and no plans (apparently) to produce one.

You might be able to use the ACE 64 bit driver: http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=23734

  • but I have no idea how that would work if you need to go back to Jet for your 32 bit apps.

However, you may be able to switch the project to 32bit in the Express version (I haven't tried and don't have 2008 installed in any flavour anymore)

Maybe it's time to scrap Access databases altogether, bite the bullet and go for SQL server instead?


We have come across this issue in desktop app.

Dev Environment: Windows 7 Ultimate - 64 bit .Net Framework 4.5 Provider=Microsoft.Jet.OLEDB.4.0

It has been resolved by changing Platform target to X86 from Any CPU. Project Properties >> Build >> Platform Target.

enter image description here


I have changed my connection string from

var myConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Persist Security Info=True;Jet OLEDB:Database Password=;",gisdbPath);

to this:

var myConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Mode=Share Deny None;Data Source={0};user id=Admin;password=;", gisdbPath);

It works fro me never asked for Microsoft.Jet.OLEDB.4.0'registered.


In older versions of IIS, you will not find Advance Settings so to enable Enable 32-bit Applications you have to execute the following commands:

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

and

%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i

Reference : Here


I had the same issue. I changed the application configuration to x86, then it worked!


Examples related to c#

How can I convert this one line of ActionScript to C#? Microsoft Advertising SDK doesn't deliverer ads How to use a global array in C#? How to correctly write async method? C# - insert values from file into two arrays Uploading into folder in FTP? Are these methods thread safe? dotnet ef not found in .NET Core 3 HTTP Error 500.30 - ANCM In-Process Start Failure Best way to "push" into C# array

Examples related to .net

You must add a reference to assembly 'netstandard, Version=2.0.0.0 How to use Bootstrap 4 in ASP.NET Core No authenticationScheme was specified, and there was no DefaultChallengeScheme found with default authentification and custom authorization .net Core 2.0 - Package was restored using .NetFramework 4.6.1 instead of target framework .netCore 2.0. The package may not be fully compatible Update .NET web service to use TLS 1.2 EF Core add-migration Build Failed What is the difference between .NET Core and .NET Standard Class Library project types? Visual Studio 2017 - Could not load file or assembly 'System.Runtime, Version=4.1.0.0' or one of its dependencies Nuget connection attempt failed "Unable to load the service index for source" Token based authentication in Web API without any user interface

Examples related to oledb

'Microsoft.ACE.OLEDB.16.0' provider is not registered on the local machine. (System.Data) How to import an Excel file into SQL Server? how to resolve DTS_E_OLEDBERROR. in ssis Check if ADODB connection is open Import Excel to Datagridview "Cannot create an instance of OLE DB provider" error as Windows Authentication user Optimal way to Read an Excel file (.xls/.xlsx) How to connect to a MS Access file (mdb) using C#? "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine" Error in importing process of xlsx to a sql server How can I export data to an Excel file

Examples related to 32bit-64bit

MS Access DB Engine (32-bit) with Office 64-bit Running vbscript from batch file Can't start Eclipse - Java was started but returned exit code=13 how much memory can be accessed by a 32 bit machine? CentOS 64 bit bad ELF interpreter Range of values in C Int and Long 32 - 64 bits Is it possible to install both 32bit and 64bit Java on Windows 7? How to find out if an installed Eclipse is 32 or 64 bit version? Missing include "bits/c++config.h" when cross compiling 64 bit program on 32 bit in Ubuntu Should I use Python 32bit or Python 64bit

Examples related to jet

Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine Autonumber value of last inserted row - MS Access / VBA Maximum number of rows in an MS Access database engine table?