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: | 406BC172.20707@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
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
> FETCH_FORWARD_ONLY.
> 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
details.
-O
From | Date | Subject | |
---|---|---|---|
Next Message | Guido Fiala | 2004-04-01 07:51:10 | Re: OutOfMemory |
Previous Message | brandon s | 2004-04-01 03:57:35 | Connection Pooling, JDBC and SSL |