Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invalid Cursor State Error...

 
Nitin Jawarkar
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,

I m trying to update one coloumn in my database table, but i m getting invalid cursor state error, i have set ResultSet Updatable and Sensitive also, next i m using J2SDK1.4.0_03, so i m not but what i m using JDBC is 2.0. So are they support to updatable resultset or not.
My code is look like this.

sql = "SELECT COMPANY_GROUP, SUB_GROUP FROM COMPANY_SUB_GROUP WHERE GIVE_PICKUP_DATA = 'Y'";
try{
rs_group = DBConnector.stmt.executeQuery(sql);
}catch(Exception ex){System.out.println("execute query first :" + ex.toString());}


try{
while(rs_group.next()) //Outer loop to process all customer groups
{
String company_group = rs_group.getString("COMPANY_GROUP");
String company_sub_group = rs_group.getString("SUB_GROUP");
System.out.println(company_group+" "+company_sub_group);
sql1 = "select pickup_id,pickup_to_customer from extranet_customer_pickup left outer join customer_reference on extranet_customer_pickup.shipmentno = customer_reference.shipmentno where customer_id in (select customer_id from customer where company_group = '"+company_group+"' AND company_sub_group = '"+company_sub_group+"') and reference1 is not null and pickup_to_customer is null";
try{
rsgroupdata = DBConnector1.stmt.executeQuery(sql1);
}catch(Exception e){System.out.println("execute query second :" + e.toString());}

try{
while(rsgroupdata.next())
{
String yes = "Y";
String pickup = rsgroupdata.getString("pickup_id");
//System.out.println("Before Update : "+pickup);
//rsgroupdata.updateString("pickup_to_customer","Y");
DBConnector2.stmt.executeUpdate("update extranet_customer_pickup set pickup_to_customer = 'Y' where pickup_id = '"+pickup+"'");
//rsgroupdata.updateRow();
//System.out.println("After Update : "+pickup);
//DBC.con.commit();
//rsgroupdata.next();
}
}catch(SQLException e) {System.out.println("Update Error : "+e.getErrorCode());}

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

Any idea about this error.

Thanx.
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Onsearching this site I foud this Thread hope that helps
 
Nitin Jawarkar
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Srinivas,

My java version is already J2SDK1.4 and JDBC is 2.0 but still i m facing the same problem, right now what i want result is getting but there is some missing in code, so due to i m getting the error Invalid cursor state.
Is there any solution on this.

Thanx..
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitin,

So are they support to updatable resultset or not?

That depends on the JDBC driver and RDBMS you are using.
Excuse me, but I couldn't find those details in your post(s).
Hence I can't answer your question.
(And I don't think anyone else can, unless you provide those missing details).

Good Luck,
Avi.
 
bijoy bose
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sure its because your JDBC drivers does not have scrolling feature because you are using and older version. download j2se1.4.2 or higher it will bring scrolling feature automatically to your JDBC....hope thats answer your problem!!

regards
Bijoy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic