problem in resultset relative method - Mailing list pgsql-jdbc

From arun vc
Subject problem in resultset relative method
Date
Msg-id 20020503074924.8233.qmail@web11503.mail.yahoo.com
Whole thread Raw
Responses Re: problem in resultset relative method  (Dave Cramer <Dave@micro-automation.net>)
List pgsql-jdbc
hello

i have found some problem in using the relative()
method of ResultSet

the problem occured when i upgrade my old
postgres.jar driver with the new one posted on ur site
http://jdbc.postgresql.org/download/pgjdbc2.jar

try exicte this program using both drivers
and u will find the difference

import java.sql.*;

public class sqlDriverTest
{
    String Driver = "org.postgresql.Driver";
    String Bridge="jdbc:postgresql://localhost/database";
    String LoginName="postgres";
    String Password="postgres";

     try
     {

           Class.forName(Driver);
           Connection con=
DriverManager.getConnection(Bridge,LoginName,Password);
        System.out.println("Connection made: " + con);

        PreparedStatement pm=con.prepareStatement("SELECT *
FROM admin");
        ResultSet rs=pm.executeQuery();

        rs.last();
        int tot=rs.getRow();    //my tot returned 10 records

        rs.beforeFirst();

        int kk=1;

        while(kk<=tot)        //the program stoped after reading 3
records and rest of the 7 records are shown wrongly
        {
            rs.relative(kk);
            System.out.println(rsProj.getString(1));
            kk=kk+1;
        }


       }
     catch(Exception e)
     {
         System.out.println("Error "+e.getMessage());
     }

    }

        //the program stoped after reading first 3 records
and rest of the 7 records are shown wrongly
        //why iam getting error in using relative() method
this problem was not in the previous postgres.jar
driver

        please look in to this problem

=====
The Future belongs to those who believe in the beauty of their dreams...............................................
Arun VC, E Team India Web Solutions,
Serene,Anupama Nagar,Pongummoodu,Trivandrum
Phone : +91 471 558089. Fax   : +91 471 551807.
http://www.e-teamindia.com
http://www.geocities.com/vcarun

__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

pgsql-jdbc by date:

Previous
From: "Scott Burgess"
Date:
Subject: Locking a table...
Next
From: Dave Cramer
Date:
Subject: Re: Locking a table...