Thread: ODBC + BYTEA

ODBC + BYTEA

From
Michael Knigge
Date:
All,

I have some trouble getting a simple SQL working over an
ODBC-Connection.  My Environment:


Client: MS-Windows XP, ODBC-Driver PSQLODBC35W.DLL, Version 08.02.0400
Server: MS-Windows XP, Version 8.2.4


My SQL:

CREATE TABLE "TestTable"
           ( "ColInt"      INTEGER ,
             "ColSmallint" SMALLINT ,
             "ColVarchar"  VARCHAR ( 50 ) ,
             "ColTimestamp" TIMESTAMP ,
             "ColChar" CHAR ( 1 ) ,
             "ColDecimal" DECIMAL ( 8 , 2 ) ,
             "ColBlob" BYTEA ) ;


Now.... when I execute this SQL via ODBC, I get a


<snip>
42704 (7:1260) ERROR: type "lo" does not exist;Error while executing the
query
</snip>



I've googled around a bit and if I got things right "lo" is somewhat an
old-style datatype for binary stuff and nowadays "bytea" should be used.

But why is the ODBC-Driver transforming it into "lo"? And when it is
still in use, why isn't the server recognizing it?


Please bring me in the right direction.....


Bye,
Michael


Re: ODBC + BYTEA

From
Alex Goncharov
Date:
,--- You/Michael (Mon, 06 Jul 2009 19:28:11 +0200) ----*
| Now.... when I execute this SQL via ODBC, I get a
|
| 42704 (7:1260) ERROR: type "lo" does not exist;Error while executing the

| I've googled around a bit and if I got things right "lo" is somewhat an
| old-style datatype for binary stuff and nowadays "bytea" should be used.

Try to set

  ByteaAsLongVarBinary = 1

in your ODBC driver configuration. On Windows use Admin Tools / Data
Sources (ODBC) -> PostgreSQL35* -> Datasources -> Page 2 -> play with
the check box "bytea as LO".

-- Alex -- alex-goncharov@comcast.net --