I am trying to add a serial number in my table. Here is my method:
public void reArrangeTrID(){
String parti = name.getText().toUpperCase();
long trid =
According to the Derby Documentation, a query with an ORDER BY is not updatable:
Only simple, single-table SELECT cursors can be updatable. The SELECT statement for updatable ResultSets has the same syntax as the SELECT statement for updatable cursors. To generate updatable cursors:
- The
SELECTstatement must not include anORDER BYclause.- The underlying Query must be a SelectExpression.
- The SelectExpression in the underlying Query must not include:
DISTINCT- Aggregates
GROUP BYclauseHAVINGclauseORDER BYclause- The
FROMclause in the underlying Query must not have:
- more than one table in its
FROMclause- anything other than one table name
- SelectExpressions
- subqueries
- If the underlying Query has a
WHEREclause, theWHEREclause must not have subqueries.
In other words you can't include the ORDER BY, but that would defeat your purpose (as you seem to be renumbering some identifier).
You either need to use some query to renumber without processing in JDBC, or you need to use two Statement objects, one to query the rows and another to update them.
Derby also does not support TYPE_SCROLL_SENSITIVE result sets. According to the documentation, Derby supports both:
Note that your current code doesn't require TYPE_SCROLL_INSENSITIVE because you are only processing it as a forward only.