Question

In a 32-bit .NET app, I can use this OLEDB connection string to connect to a CSV file via ADO.NET:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\foo;"

or this ODBC one:

"Driver={{Microsoft Text Driver (*.txt; *.csv)}};Dbq=c:\foo"

However there apparently arent 64-bit versions of either the OLEDB Jet drivers or the ODBC text driver.

I could parse the CSV line by line or run the app in 32-bit mode, but ideally I'd just like to find a different driver that runs as 64-bit.

Any ideas?

Was it helpful?

Solution

It's not a driver, but I've been pleased with Sebastien Lorion's CSV reader. Note that I've never used it in a 64-bit environment, but I'm not aware of any compatibility issues.

http://www.codeproject.com/KB/database/CsvReader.aspx

OTHER TIPS

I had this exact same problem and after much trial & error this was what I found that worked:

1. Enable Adhoc procedures

sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO

2. Install this file on server:

http://www.microsoft.com/downloads/en/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en

3. Use this query format:

SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Text;Database=C:\SQL\;HDR=Yes;','SELECT * FROM [test.csv]');

4. Enable OLE Automation procedures:

sp_configure 'show advanced options', 1;
GO
RECONFIGURE with override
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE with override;
GO

Alexis,

Do you need a driver at all? If you just need to read a CSV file line by line there are a number of free parsers out there. If you need to also write out a CSV check out FileHelpers.

I ended up having to convert my application to 32-bit because I was having the same problem, although with accessing a Microsoft Access Database. I know this will work, but you may not want this solution. If anyone knows the answer to this question I woud love to hear it as well.

You're in luck-- in December 2010 Microsoft published a a 64-bit OLEDB driver for CSV and XLSX files!

See this answer for download links, install details, connection strings, etc.

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