Skip site navigation (1) Skip section navigation (2)

Re: OutOfMemory

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Guido Fiala <guido(dot)fiala(at)dka-gmbh(dot)de>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: OutOfMemory
Date: 2004-04-01 07:14:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Guido Fiala wrote:
> Oliver Jowett wrote:
>>(... later ...) Hold on -- doesn't last() require a scrollable
>>resultset, which means you're not using a cursor behind the scenes? I
>>think the driver does not throw an exception if you try to use
>>last()/absolute()/etc with FETCH_FORWARD_ONLY (it should!) but instead
>>just gives you the wrong results.. not great, but this is not only the
>>fault of the driver :)


> So i walked through the source tree and saw that it only would use the
> fetchsize by using "FETCH FORWARD ..." if the ResultSetType is set to
> This does indeed fetch only fetchsize rows but then i was stuck... so here
> is my TextCase:


> 			//test forward-only
> 			System.out.println("test: TYPE_FORWARD_ONLY");
> 			conn.setAutoCommit(false);//to allow cursors below
> 			Statement 
> st=conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
> 			st.setFetchSize(1);
> 			ResultSet rs=st.executeQuery("Select * from tst_fetchsize");
> 			rs.last();//now we should be at "count"

Indeed, here's your problem -- you're not allowed to call last() on a 
TYPE_FORWARD_ONLY resultset. The driver should throw an exception at 
this point (but currently doesn't). See the ResultSet.last() javadoc for 


In response to


pgsql-jdbc by date

Next:From: Guido FialaDate: 2004-04-01 07:51:10
Subject: Re: OutOfMemory
Previous:From: brandon sDate: 2004-04-01 03:57:35
Subject: Connection Pooling, JDBC and SSL

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group