wood burning stoves 2.0*
The moose likes JDBC and the fly likes Invalid Cursor State Error... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Invalid Cursor State Error..." Watch "Invalid Cursor State Error..." New topic
Author

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.

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.


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.

Thanx..
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121

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

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!!

regards
Bijoy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invalid Cursor State Error...
 
Similar Threads
Problem with ResultSet
Error while inserting data into from a JSP Page
Invalid cursor state
Help with JSP Page
Invalid cursor state