Question

So I have learned that that the Microsoft.Jet.OLEDB.4.0 data provider for querying data sources like Microsoft Access MDB files and Excel spreadsheets does not work under a Windows 64-bit operating systems.

What I am now supposed to use to query against these file types in .NET 3.5 (C#) applications in order to ensure compatibility in both x86 and x64 environments? I have scoured the Internet and I cannot seem to find a straight answer on how to handle this incompatibility.

I've also tried using an ODBC provider and a MSDASQL provider with no luck as they seem to throw the same exceptions as the Microsoft.JET.OLEDB.4.0 provider does when used in a x64 environment (unless I am doing something flagrantly wrong with these other two providers even though they work fine under in my Windows XP x86 environment).

I’ve found people saying that I need to use %WINDIR%\System32\odbcad32.exe for ODBC connectivity in x64 systems, but I have on idea how to utilize this.

Example Exeption Thrown Under x64:

************** Exception Text ************** System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper) at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)

Was it helpful?

Solution

Everything that I've seen in my own recent research confirms what you are seeing - that there simply isn't a 64-bit Jet driver. Also, I found a post on THIS thread that seems to confirm that the 64-bit MSDASQL won't help as it is really just a wrapper (see the last post, dated May 8 from Ricky Wen). Your only option is to link thru a 32-bit proxy, perhaps another 32-bit SQL server. I may end up doing this myself, until I can move the Jet data to SQL.

OTHER TIPS

what's happening here is that a x64 assembly is trying to call a x86 COM component. The x64 app won't see the COM registrations in the primary x64 registry,since theyre in the wow6432node hive.

Easiest workaround is to build the application with a x86 target platform and let it run on the WOW later on your x64 machine. The app will run as 32-bit and be able to see the 32-bit COM objects it needs.

There is now a 64 bit ODBC driver for JetSQL. It is the Microsoft Access Database Engine 2010 Redistributable. I have not used it for OLEDB, but I have used it to make new Microsoft Access databases with PowerShell.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top