Re: OutOfMemory

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: OutOfMemory
Дата
Msg-id 406BC172.20707@opencloud.com
обсуждение исходный текст
Ответ на Re: OutOfMemory  (Guido Fiala <guido.fiala@dka-gmbh.de>)
Ответы Re: OutOfMemory
Список 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

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

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: very interesting JDBC problem ...
Следующее
От: Guido Fiala
Дата:
Сообщение: Re: OutOfMemory