Re: ResultSet.getClob() causing problems when used with JPA's @Lob

From: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: ResultSet.getClob() causing problems when used with JPA's @Lob
Date: 2016-07-20 13:52:04
Message-ID: CAB=Je-F7KnH7ogBhsVhk0mo-KTO-WOOyX52s5DeMFspa6bKC_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

1) AFAIK, Oracle allows to use getString/setString for clob columns when
using Oracle JDBC driver 10.2 or higher. Basically you set
SetBigStringTryClob=true
connection option and that is it.

2)
Thomas>I don't think checking the column type is necessary (at least not
for me).
Thomas>If this option is enabled, then all calls to getClob() are simply
"re-routed" to getString().

I'm afraid you miss the point.

In postgresql world, there's "large object API":
https://www.postgresql.org/docs/current/static/lo-interfaces.html
pgjdbc wraps that, so if you have a column of "oid" type, then you can
access the value via getClob and pgjdbc would reroute the calls to large
object API.

So getLong is not a mistake in getClob. getLong is here to retrieve the
value of "large object oid" (i.e. pointer). That is why column type is
crucial to tell if getClob is dealing with "large object API" or "just a
string".

Vladimir

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Thomas Kellerer 2016-07-20 14:55:26 Re: ResultSet.getClob() causing problems when used with JPA's @Lob
Previous Message Thomas Kellerer 2016-07-20 13:40:53 Re: ResultSet.getClob() causing problems when used with JPA's @Lob