Re: cursor "jdbc_curs_1" does not exist - Mailing list pgsql-jdbc

From tmp@nitwit.de
Subject Re: cursor "jdbc_curs_1" does not exist
Date
Msg-id 200406171449.12604.tmp@nitwit.de
Whole thread Raw
In response to Re: cursor "jdbc_curs_1" does not exist  (Kris Jurka <books@ejurka.com>)
Responses Re: cursor "jdbc_curs_1" does not exist  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
On Tuesday 15 June 2004 19:38, you wrote:
> It is unclear what the differences here are.  You haven't shown the
> Statement creation and/or execution, so it's possible that you haven't
> used setFetchSize or you've specified a scrollable ResultSet.  Maybe auto
> commit is on.  Any of these will cause a cursor not to be used and the
> results will be fetched in bulk, so an intermediate commit won't cause any
> problems.  Maybe the query doesn't retrieve 100 rows, so it doesn't get to
> the commit part.

And why doesn't this work:

db.setAutoCommit(false);

final Statement select =
db.createStatement(ResultSet.HOLD_CURSORS_OVER_COMMIT,
ResultSet.CONCUR_READ_ONLY);
select.setFetchSize( Configuration.FETCH_SIZE );

int i = 0;
for( final ResultSet row = select.executeQuery( sql ); row.next(); i++)
{
    ...
    insert.execute();
    continue;

    if (i%100==0) db.commit();
}

BTW ResultSet.TYPE_SCROLL_INSENSITIVE doesn't work either :-(

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Prepare Statement
Next
From: Oliver Jowett
Date:
Subject: Re: cursor "jdbc_curs_1" does not exist