Re: PGSQL problem with weblogic and OID data type

Поиск
Список
Период
Сортировка
От Phillip F Jansen
Тема Re: PGSQL problem with weblogic and OID data type
Дата
Msg-id 3B53E083.9507DB58@ucs.co.za
обсуждение исходный текст
Ответ на PGSQL problem with weblogic and OID data type  ("Sanath Peiris" <bspeiris@lycos.com>)
Список pgsql-hackers
Sanath Peiris wrote:
> 
> Hi everybody,
> 
> I gotta this problem while I was trying to work with weblogic and postgresql with storing images as byte arrays.
> 
> First, I used JBOSS-2.2.2  as an application server and Postgresql-7.0.3 as a database serevr to run one of my Java
enterpriseapplications. There I used "OID" data type to store images, and worked fine with the above combination. I
usedjdbc7.0-1.2.jar as a postgresql  jdbc driver.
 
> 
> Please look at the sample codes given below.
> 
> InputStream banner;
> String bannerID = "some id';
> PreparedStatement pstmt =
>                 dbConnection.prepareStatement(?Insert into tablename (BannerID, Banner)  values(?,?)?);
> int NoOfBytes = banner.available();
> byte[] bytebuffer = new byte[NoOfBytes];
> banner.read(bytebuffer);
> pstmt.setString(1, bannerID);
> pstmt.setBytes(2, bytebuffer);
> int resultCount =  pstmt.executeUpdate();
> 
> After this, I successfully deployed this application in weblogic-6.0 using the same Postgresql database and the jdbc
driver.There, some other database accessing parts worked fine, but the above image thing is not worked and gave an
errormessage like "FastPath call returned ERROR: lo_write: invalid large obj descriptor (0)".
 
> 
> I think nothing wrong with the codes...and can be a driver problem with weblogic..Can anybody explain the above pls.


Sanath

Dont know if anybody replied to your question yet. But you should set
your AutoCommit to false e.a conn.setAutoCommit(false); Do this before
you execute your preparedstatement.
That should fix your problem.

Regards
Phillip


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Philip Warner
Дата:
Сообщение: Re: Odd error...
Следующее
От: Christopher Yap
Дата:
Сообщение: deferencing array of int8