Re: TEXT columns should indentify as java.sql.Types.CLOB

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: TEXT columns should indentify as java.sql.Types.CLOB
Date: 2010-08-16 13:47:49
Message-ID: i4bfi5$k4k$1@dough.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Oliver Jowett wrote on 16.08.2010 13:18:
> Thomas Kellerer wrote:
>> Toni Helenius wrote on 16.08.2010 11:01:
>>> I'm using Postgres 8.3.11 database and the latest JDBC driver 8.4
>>> Build 701 (JDBC 4) + Java 6. In our databases there are TEXT type
>>> columns. However if I make a query to identify these fields in Java,
>>> the field DATA TYPE is VARCHAR and the length is 2147483647. Type
>>> name is correct; "TEXT". But as we need database independent code, we
>>> are using DATA TYPE as I presume is correct. And I think these TEXT
>>> fields should return java.sql.Types.CLOB as DATA TYPE instead of
>>> VARCHAR.
>>
>> I agree, this would make the driver more JDBC compatible and it would
>> behave more like other drivers.
>
> Returning Types.CLOB would imply that the preferred way to deal with
> those columns is via getClob() / setClob(), which surely isn't correct
> for TEXT columns in most cases?
>

Not necessarily.

Almost all drivers I know (Oracle, jTDS, MySQL and DB2 I think) can handle getString() on a CLOB column without problems. (Oracle only since it's 10.x drivers)

Regards
Thomas

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kevin Grittner 2010-08-16 14:28:32 Re: TEXT columns should indentify as java.sql.Types.CLOB
Previous Message Oliver Jowett 2010-08-16 11:18:25 Re: TEXT columns should indentify as java.sql.Types.CLOB