Max size for bytea type - Mailing list pgsql-jdbc
From | Do, Leon \(Leon\) |
---|---|
Subject | Max size for bytea type |
Date | |
Msg-id | D1EE06BA46B1E4449AF9A4F2FBEE18616FB822@ILEXC2U01.ndc.lucent.com Whole thread Raw |
In response to | Re: Memory leaks using refcursors (Dave Cramer <pg@fastcrypt.com>) |
Responses |
Re: Max size for bytea type
|
List | pgsql-jdbc |
Hello, Can someone explain why I cann't get bytea data of more than 1998 bytes? Below 1998 size is ok but I got exception if the size is at and above 1998. I used jdbc-8.1-407.jdbc3.jar. //setting bytea value. Work fine byte[] bdata = new byte[1998]; for (int b = 0; b < bdata.length; b++) { bdata[b] = (byte) (b % Byte.MAX_VALUE); } ByteArrayInputStream is = new ByteArrayInputStream(bdata); prepstmt.setBinaryStream(1, is, bdata.length); //getting bytea value. Got error ByteArrayInputStream s = (ByteArrayInputStream) rs .getBinaryStream(1); Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1998 at org.postgresql.util.PGbytea.toBytes(PGbytea.java:39) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBytes(AbstractJdbc2Result Set.java:2048) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBinaryStream(AbstractJdbc 2ResultSet.java:2168) Thanks Leon Do > -----Original Message----- > From: pgsql-jdbc-owner@postgresql.org > [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Dave Cramer > Sent: Friday, January 19, 2007 2:13 PM > To: Guillaume Smet > Cc: PostgreSQL JDBC; Tom Lane > Subject: Re: [JDBC] Memory leaks using refcursors > > > On 19-Jan-07, at 11:07 AM, Guillaume Smet wrote: > > > On 1/19/07, Dave Cramer <pg@fastcrypt.com> wrote: > >> I believe the problem is in the server's XA code somehow > not closing > >> unnamed parameters properly. > >> > >> If you could run the code I sent you and tell me if it > causes a leak, > >> then that will confirm it. > > > > Sorry, I did not understand what you've asked me. I just > run the test > > without the XA code and it has the memory leak with the old 408 > > driver. > > IMHO, it's quite logical as this memory leak has nothing to do with > > the transaction management as all the operations are in a big > > transaction. > > When I close the transaction, XA or not XA, the backend used by the > > connection returns to a normal memory usage. > > So I've sent Guillaume a driver which closes the refcursor > directly after reading the contents for testing. > > So far so good. > > Dave > > > > -- > > Guillaume > > > > ---------------------------(end of > > broadcast)--------------------------- > > TIP 5: don't forget to increase your free space map settings > > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org >
pgsql-jdbc by date: