Re: can't write a BLOB, 7.1.2
От | Dejan Vucinic |
---|---|
Тема | Re: can't write a BLOB, 7.1.2 |
Дата | |
Msg-id | F131sseOYqFlro9ZAqH0000476e@hotmail.com обсуждение исходный текст |
Ответ на | can't write a BLOB, 7.1.2 ("Dejan Vucinic" <hotdejan@hotmail.com>) |
Ответы |
Re: can't write a BLOB, 7.1.2
|
Список | pgsql-jdbc |
>"Dejan Vucinic" <hotdejan@hotmail.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@sss.pgh.pa.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
В списке pgsql-jdbc по дате отправления: