lo_tell problem with JDBC and RC4

From: Elijah Roberts <eroberts(at)alexandriasc(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: lo_tell problem with JDBC and RC4
Date: 2000-05-04 06:20:36
Message-ID: 4.3.1.0.20000504020124.00b63278@galilaei
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm having a problem with JDBC and large objects. I'm using 7.0RC4 and JDBC
2. I have a table like the following:

CREATE TABLE document_Page
(
...
data OID NULL
...
);

I insert using the JDBC PreparedStatement.setBytes(1, data), and it works.
I have exported the object using the \lo_export command in psql and it
comes out ok. When I try to select the data through JDBC, though, I have
problems.

If I use the following code, I simply get the object ID, such as 280065,
which is understandable:

st = db.prepareStatement("SELECT data FROM document_page");
rs = st.executeQuery();
if (rs.next()) rs.getString(1);

However, if I use the following line instead, to try to get the data:

if (rs.next()) rs.getBytes(1);

I get the following exception:

FastPath call returned ERROR: lo_tell: invalid large object descriptor (0)
at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:141)
at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:191)
at org.postgresql.fastpath.Fastpath.getInteger(Fastpath.java:203)
at org.postgresql.largeobject.LargeObject.tell(LargeObject.java:232)
at org.postgresql.largeobject.LargeObject.size(LargeObject.java:247)
at org.postgresql.jdbc2.ResultSet.getBytes(ResultSet.java:370)

It seems to me it may be trying to use 0 as the oid [object descriptor (0)
at], but I don't know if that's accurate. It seems like it should be able
to get the correct oid, as it prints it out fine when I use getString to
retrieve the result.

Any thought? BTW, I'm running the server on Solaris and the client on
WindowsNT with Sun's JDK 1.3 RC2.

Elijah Roberts
Java Consultant
eroberts(at)alexandriasc(dot)com
606-816-1186

Browse pgsql-general by date

  From Date Subject
Next Message Vladimir V. Zolotych 2000-05-04 06:43:41 Re: Removing NOT NULL Contraint
Previous Message Zhou, Lixin 2000-05-04 00:11:05 JDBC fails while used from remote machine...