Re: jdbc cursor positioning

From: Dave Cramer <Dave(at)micro-automation(dot)net>
To: David Wall <d(dot)wall(at)computer(dot)org>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: jdbc cursor positioning
Date: 2002-10-07 13:43:13
Message-ID: 1033998193.1776.1.camel@inspiron.cramers
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org)
>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jeff Duffy 2002-10-07 15:57:28 NullPointer error returned from ResultSet.java
Previous Message Felipe Schnack 2002-10-07 13:15:29 OFF-TOPIC: cvs