Kbase P104716: Getting an SQLException when calling the moveToInsertRow method from a Java Open Client
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/26/2005 |
|
Status: Unverified
SYMPTOM(s):
Getting an exception when calling the moveToInsertRow method from a Java Open Client
java.sql.SQLException null
Updating a ResultSet from a Java Open Client
The ResultSet is returned by a Progress procedure with a Temp-Table output parameter
CAUSE:
This is expected behavior. The result set returned by the Progress procedure is a read only result set.
The moveToInsertRow method returns exception SQLException if a database access error occurs or the result set is not updatable.
Since the ResultSet object returned by Progress is a read-only result set, the SQLException is therefore generated.
FIX:
Use a SDOResultset Object instead.
Since the SDOResultset object is an updatable result set, the moveToInsertRow can be called.
For example:
In the code below, it assumes that a SDO, called "dcustomer.w", has been created against the "customer" table of the sports2000 database.
import com.progress.open4gl.*;
import java.sql.ResultSet;
AppObjet ao = new AppObjet("AppServer://localhost:5162/asbroker1","","","");
ResultSetHolder rsh = new ResultSetHolder ();
SDOResultSet rSet = ao._createSDOResultSet("dcustomer.w");
//
// Adding a new record in the customer table
// custnum = 30000, name = "Progress"
//
rSet.startBatch();
rSet.moveToInsertRow()
rSet.updateInt("custnum", 3000);
rSet.updateString("name", "Progress");
rSet.insertRow();
rSet.sendBatch();
ao._release();