I have a csv file that I'm trying to import into a Sybase SQL Anywhere database using the SABulkCopy (Sybase's version of SQLBulkCopy) class in C# .NET. The csv file's first column maps to a 64bit integer primary key value in the Sybase DB. There is also binary data (larger than 510 bytes) in one of the columns as well. Using Jet 4.0 OleDB to access the csv file may not be the best way of doing a bulk insert, but I don't know of another way to get this done using a csv source file. The whole point of this is to avoid writing all of the inserts to the log, as the blob data is expendable but needs to be imported in a quick fashion. I'm using a schema.ini file to map the datatypes in the csv file, the problem is that the "Long" datatype is only for 32bit integers. This causes an error when I feed the OleDB DataReader to SABulkCopy.WriteToServer() since the DB expects a 64bit integer, not a 32bit one.
Asked
Active
Viewed 241 times
1 Answers
0
You can't do this using Jet 4.0, but you don't need to. You can get the 64-bit Access Engine redistributable at http://www.microsoft.com/en-us/download/details.aspx?id=13255. You'll also need to update your connection string 'Provider' to "Microsoft.ACE.OLEDB.12.0".
If using a separately installed engine is not possible, you can always do a simple file read and parse out the data like this.

PinnyM
- 35,165
- 3
- 73
- 81
-
That's the problem. I kind of need to use built-in methods to do this and not something that needs to be installed additionally. – user1197862 May 22 '12 at 04:53
-
The Jet 4.0 Engine also needs to be 'installed' - it's just a question of which engine you are installing... And if you have Office 2007 or later installed then the new engine is already available for connection. In any event, see if the other option I provided works for you. – PinnyM May 22 '12 at 13:28
-
I ended up taking the actual files that made up the blob columns in the csv and importing them into the database directly, thus bypassing the need to process a csv file. SABulkCopy still writes the inserts to the log unfortunately, so I don't think there's any way to avoid it. – user1197862 May 24 '12 at 13:20