File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Invalid Cursor State Error... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Invalid Cursor State Error..." Watch "Invalid Cursor State Error..." New topic

Invalid Cursor State Error...

Nitin Jawarkar
Ranch Hand

Joined: Dec 18, 2004
Posts: 79
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.

rs_group = DBConnector.stmt.executeQuery(sql);
}catch(Exception ex){System.out.println("execute query first :" + ex.toString());}

while( //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";
rsgroupdata = DBConnector1.stmt.executeQuery(sql1);
}catch(Exception e){System.out.println("execute query second :" + e.toString());}

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

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

Any idea about this error.


Cheers<br />Nitin
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
Onsearching this site I foud this Thread hope that helps

Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Nitin Jawarkar
Ranch Hand

Joined: Dec 18, 2004
Posts: 79
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.

Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1141


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,
bijoy bose
Ranch Hand

Joined: Mar 27, 2004
Posts: 32
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!!

I agree. Here's the link:
subject: Invalid Cursor State Error...
It's not a secret anymore!