pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tmp@nitwit.de
To: pgsql-jdbc@postgresql.org
Subject: Re: cursor "jdbc_curs_1" does not exist
Date: Tue, 15 Jun 2004 18:53:58 +0200
Message-ID: <200406151853.58666.tmp@nitwit.de> (raw)
In-Reply-To: <Pine.BSO.4.56.0406151102540.13010@leary.csoft.net>
References: <200406151736.27450.tmp@nitwit.de>
	<Pine.BSO.4.56.0406151102540.13010@leary.csoft.net>

On Tuesday 15 June 2004 18:06, you wrote:
> The problem here is that you commit every 100 rows.  A commit closes any
> open cursors, so the next time you try to call next the cursor isn't there
> any more.

Hmm. And why does this code work then:

		for( int j = 1; row.next(); j++ )
		{
			String id = row.getString( "id" );
			URL url = new URL( row.getString( "url" ) );
			Timestamp time = row.getTimestamp( "timestamp" );

			try
			{
				insertUrls.setString( 1, id );
				insertUrls.setString( 2, url.toString() );
				insertUrls.setString( 3, resp.getText() );
				insertUrls.execute();
			}
			catch( Exception e )
			{
				System.err.println( e );
			}
			finally
			{
				if( j % 100 == 0 )
				{
					System.out.println();
					f4t.commit();
				}
			}
		}



view thread (8+ messages)  latest in thread

Message-ID: <200406151853.58666.tmp@nitwit.de>
Permalink:  ../200406151853.58666.tmp@nitwit.de/
Also on:    postgresql.org/message-id/200406151853.58666.tmp@nitwit.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: tmp@nitwit.de
  Subject: Re: cursor "jdbc_curs_1" does not exist
  In-Reply-To: <200406151853.58666.tmp@nitwit.de>
  References: <200406151736.27450.tmp@nitwit.de> <Pine.BSO.4.56.0406151102540.13010@leary.csoft.net> <200406151853.58666.tmp@nitwit.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox