[Mono-list] ODBC: Fetching a byte array from PostgreSQL

Helge Lenuweit helge@lenuweit.net
Wed, 17 Nov 2004 12:51:39 +0100


Hello,

I'm having a hard time fetching a byte array from a PostgreSQL database 
(bytea column type) with mono/Odbc. (I know, there's Npgsql, but there 
would be quite a bit of code to port, so...). While it works with 
MS.NET, mono throws an InvalidCastException. As far as I can see, both 
iODBC/the psqlodbc Driver can be excluded from causing this issue. All 
other relevant data types work well.

OdbcDataReader reports the correct System.Type (which is byte[]) for the 
columns in question, while filling a DataSet crashes at the Fill 
command. Retrieving the value through the Reader's GetValue command 
results in an object of type "string".

Is this likely to be a mono issue or do I have to look at the setup of 
the other components involved?
Regards, Helge