File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes invalid cursor type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "invalid cursor type" Watch "invalid cursor type" New topic
Author

invalid cursor type

Naadir Peterson
Ranch Hand

Joined: Sep 22, 2004
Posts: 37
Hi

I'd like to move to certain row when making a query but it throws an invalid cursor type error. Can anyone help me figure out what i'm doing wrong?

Thanks

Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
rs.absolute(y);
// get data
}
Rawat (Zeon)
Greenhorn

Joined: Feb 12, 2005
Posts: 5
Hi

Try to use the following code and see if it works

Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = st.executeQuery(query);
if(rs.next()) {
if(rs.absolute(y)) // this throws SQLException check JDK API's
{
// get data
} // end of if
else
// row doesn't exsist
} // end of else
} // end of outer if
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

"Zeon",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: invalid cursor type
 
Similar Threads
WA #1.....word association
JDBC & SQL Error List Help
what is ref cursor?
Invalid cursor state exception problem from resultset
why is this happening URGENT