From: | "Dejan Vucinic" <hotdejan(at)hotmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Cc: | tgl(at)sss(dot)pgh(dot)pa(dot)us |
Subject: | Re: can't write a BLOB, 7.1.2 |
Date: | 2001-07-11 19:05:52 |
Message-ID: | F131sseOYqFlro9ZAqH0000476e@hotmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
>"Dejan Vucinic" <hotdejan(at)hotmail(dot)com> writes:
> > I'm trying to create a BLOB with the 7.1.2 JDBC driver and both
> > setBytes() and setBinaryStream() fail with this message:
> > FastPath call returned ERROR: lo_write: invalid large obj descriptor
>(0)
>From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
>Probably you are not wrapping the operation into a transaction
>(BEGIN/COMMIT). Large object descriptors are only good to the end of
>the current transaction.
I believe I am, the code looks like this:
connection.setAutoCommit(false);
insert = connection.prepareStatement(
"INSERT INTO FOO (A, B) VALUES (?, ?)");
insert.setString(1, somestring);
insert.setBytes(2, byte[] xx);
insert.executeUpdate();
connection.commit();
connection.setAutoCommit(true);
The exception gets thrown out of setBytes, at the point where the
driver tries to close the stream that copied the bytes into the LOB,
and long before the SQL statement actually gets executed.
[Note that this is neither the first nor the last statement on that
connection, since connections get pooled by the app server; could
this be causing the problem?]
Thanks,
--dv
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
From | Date | Subject | |
---|---|---|---|
Next Message | Dejan Vucinic | 2001-07-11 19:19:31 | RE: [PATCH] setTimestamp(int, Timestamp) fails on null timestamp |
Previous Message | Dave Cramer | 2001-07-11 18:38:26 | RE: [PATCH] setTimestamp(int, Timestamp) fails on null timestamp |