Querying Jet Databases/Excel files with C# under x64 OS

64-bitjetodbcoledb

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)

Best Answer

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.

Related Topic