• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invalid Cursor State HELP!

 
Chris Poirot
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As soon as run the program I get a invlid cursor state here is the code!
import java.sql.*;
public class DataAccess
{
ResultSet rsData;

public void modifyDatabase(String strSQL){
try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc:BookStoreDSN");
con.createStatement().executeUpdate(strSQL);
}
catch(ClassNotFoundException cnfe){
System.out.println("the modify database method class not found exception occurred" + cnfe);
}
catch(SQLException se){
System.out.println("SQLException in the modify database"+se);
}
catch(Exception e){
System.out.println("Generic Exception in the modify database method"+e);
}
}

public ResultSet getRecords(String strSQL){
try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc:BookStoreDSN");
rsData = con.createStatement().executeQuery(strSQL);
System.out.println(rsData.getString("Item"));
}
catch(ClassNotFoundException cnfe){
System.out.println("the modify database method class not found exception occurred" + cnfe);
}
catch(SQLException se){
System.out.println("SQLException in the modify database"+ se);
}
catch(Exception e){
System.out.println("Generic Exception in the modify database method"+ e);
}
return rsData;
}
}
 
Dan Richardson
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following call:

needs to be preceded by a call to set the cursor to a row, such as . . .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic