Exceptions using 4D ODBC Driver in C#

1.4k views Asked by At

I have a 4D database that I'm trying to get data from (and export to an SQL DB) using their ODBC Driver.

Most of the tables I can read, so I know the driver works.

But I have 5 tables that throw 4 diferent exceptions in the Fill method of the OdbcDataAdapter.

  1. an exception with an empty message
  2. duplicate column exception(in the doc OdbcDataAdapter Fill should be able to overcome this)
  3. ERROR [S1000] [Simba][Simba ODBC Driver][Codebase File Library]
  4. Attempted to read or write protected memory

I'm reading MS documentation, but I dont have access to 4D documentation.

My hope is that someone here as had some experience with this kind of situation and can point me in the right direction.

Thanks in advance.

2

There are 2 answers

0
James On

I'd agree that the 4D ODBC driver is very particular.

Specifically it requires strong type casting. IE CAST(1 as boolean) for boolean values.

4D also has specific data types picture in addition to blob. See below links

http://docs.4d.com/4Dv14R4/4D/14-R4/Principles-for-integrating-4D-and-the-4D-SQL-engine.300-1733038.en.html

List all the 4D System tables that have schema information http://docs.4d.com/4Dv14R4/4D/14-R4/System-Tables.300-1733035.en.html

0
CHS On

There are certain data types in 4D that will cause problems. For example I know blob, interval, and int64 can be trouble.

On thing you can do though is cast the fields into VARCHAR in your select statement to 4D.

Like:

SELECT Field1, Field2, CAST(ProblemField AS VARCHAR) FROM MyTable

What version of the driver are you using? I've been using 12.02 but I know there are newer versions that have fixed some bugs, I'm just not sure how to get ahold of them.