Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My updatable result sets have suddenly become non-updatable

 
Chris Martz
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all -

The following code used to work and now it is not working. I'm on Windows 8.1 using netbeans. Don't know if it an MS file permission thing or what. It just stopped working and I haven't changed anything that I remember.

Thanks

private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
try {
String uName = "guest";
String uPass = "guest";
String host = "jdbc:derby://localhost:1527/erTracker";
Connection erTrackerCon = DriverManager.getConnection( host,uName,uPass );

// erTrackerCon.setAutoCommit(true);
milestonesStmt = erTrackerCon.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
String SQL = "SELECT * FROM milestones order by milestoneID";
rsMilestones = milestonesStmt.executeQuery( SQL );
String a = "02";
String b = "M";
String c = "Move to prospect";
int concurrency = rsMilestones.getConcurrency();
System.out.println("the answer is " + concurrency); // the answer is 1007
rsMilestones.moveToInsertRow(); // this gives the following error: 'moveToInsertRow' not allowed because the ResultSet is not an updatable ResultSet.
rsMilestones.updateString("milestoneID", a);
rsMilestones.updateString("milestoneType",b);
rsMilestones.updateString("milestoneName", c);
rsMilestones.insertRow( );
//String SQL = "INSERT INTO milestones (milestoneid,milestonetype,milestongname) VALUES ('02','M','move to pursue')";
//rsMilestones = milestonesStmt.executeQuery( SQL );
}
catch ( SQLException err ) {
System.out.println( err.getMessage( ) );
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic