aspose file tools*
The moose likes JDBC and the fly likes Retrieving data from cachedRowSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Retrieving data from cachedRowSet" Watch "Retrieving data from cachedRowSet" New topic
Author

Retrieving data from cachedRowSet

renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
Hi,
I am using somehting like this,
loRS.getString("employee_no") to fetch the value from the Resultset object. Employee_no is the column name in the table.
I am trying to find the maximum value in a column by using the query
select max(marks) from employee.Now i tried using the int max_marks=loRS.getInt(1);
But i am getting java.sql.SQLException: Invalid cursor position exception.
Please tell me how can i retrieve the value. Thanks.

What i want to know is how can i get the value from the resulset object if i don't have the column name. As in this case, in which it is returniing the maximum value of a particular column.
[ November 27, 2008: Message edited by: renu richard ]

Cheers,
Richard
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

You have to call "next()" on the result set before you can get data from it. For example:


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

More related to DB than beginner.
Moving.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retrieving data from cachedRowSet
 
Similar Threads
mysql enum to java string
How to query a value typed object
How to query a certain number of data?
mysql enum to java string
Hiding group of rows depending on dropdown list