Nikhil ,
My Result set is scrollable and updatable (that is verified !)
and the cursor does move to the last row when I use rs.last() ,
but I'm still unable to retrieve the row number with rs.getRow() (after
using the last() method , otherwise it (getRow())
works fine.
( and as mentioned , the absolute() works only with positive numbers and
does not exceeds row 1800 while
know there are more than 2000 rows in the RS.
(I'm using the AS400 jdbc driver with AS400 db - DB2).
Thanks
Isaac
"Nikhil R. silsarma"
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
> cc:
Sent by: "A mailing Subject: Re: JDBC - Getting row
number
list for discussion
about Sun
Microsystem's Java
Servlet API
Technology."
<SERVLET-INTEREST@jav
a.sun.com>
21/09/00 15:33
Please respond to "A
mailing list for
discussion about Sun
Microsystem's Java
Servlet API
Technology."
Isaac,
Can you please try with the following:
////////////////////////////////////
try
{
Statement myStatement =
dbConn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY
);
ResultSet rSet = myStatement.executeQuery ("SELECT Vendor_Id FROM
DR_Vendor");
rSet.last();
System.out.println("Total rows:"+rSet.getRow());
}
catch (Exception e )
{
System.out.println("SQLException"+e.getMessage());
}
finally
{
try
{
dbConn.close();
}
catch(SQLException e)
{
System.out.println("SQLException: Can't close");
}
}
///////////////////////////////////////
Where dbConn is the connection object..
I am sure it will work..
Cheers,
Nikhil
>From: Gary Lyons <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: JDBC - Getting row number
>Date: Wed, 20 Sep 2000 17:59:36 -0400
>
>Isaac,
>
>The jdbc implementation varies from driver to driver and db to db. So not
>all
>methods work in all drivers. For instance I use msql a lot and there is no
>way
>to get the number of rows returned without reading them all in like:
>
>while(rs.next()){
>
>do something
>}
>
>You may be experiencing the same problem
>
>Gary Lyons
>
>Isaac Zinner wrote:
>
> > Hi All !
> >
> > I'm trying to get row no. from a big result set (>2000 rows).
> > When I try rs.absolute with a value higher than 1800~ and then
>rs.getRow I
> > get 0.(same with negative no.)
> > When I try rs.last() and then rs.getRow I still get 0 ( tried previous
()
> > too). However when I print the rows I do get them from
> > the end correctly . How do I get the cursor to be positioned on the
last
> > row so I can get it's no. (with getRow) and not 0.
> >
> > Thanks
> >
> >
>
___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html