Re: jdbc cursor positioning - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: jdbc cursor positioning
Date
Msg-id 1033998193.1776.1.camel@inspiron.cramers
Whole thread Raw
In response to Re: jdbc cursor positioning  ("David Wall" <d.wall@computer.org>)
Responses Re: jdbc cursor positioning
List pgsql-jdbc
This is a sample program which uses cursors

      con = getConnection();
      con.setAutoCommit( false );
      Statement stmt = con.createStatement();

      int result = stmt.executeUpdate( "declare test cursor for select *
from orders" );
      System.out.println( "Created cursor, result is " + result );
      result = stmt.executeUpdate( "move 0 in dave");
      result = stmt.executeUpdate( "move -"+result+"in dave");

      for(;;)
      {
    rs = stmt.executeQuery("fetch forward 5 in test");
        if ( !rs.next() )
      break;
      }

      while(rs.next()){
        System.out.println("Id -->" + rs.getObject(1).toString());
      }
      rs.close();
      con.commit();
      con.close();


Dave
On Sun, 2002-10-06 at 22:57, David Wall wrote:
> > No, postgres fully supports cursors, the problem must be somewhere else.
>
> How do you make use of them from JDBC?
>
> David
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>




pgsql-jdbc by date:

Previous
From: Felipe Schnack
Date:
Subject: OFF-TOPIC: cvs
Next
From: Jeff Duffy
Date:
Subject: NullPointer error returned from ResultSet.java