The DB2 driver supports cursor type OUT parameters for DB2 for Linux, UNIX, Windows stored procedures. To retrieve data from cursor output parameters, take the following steps:

  1. Define a ResultSet object for each OUT parameter with the cursor data type.
  2. Invoke the Connection.prepareCall method with the CALL statement as its argument to create a CallableStatement object.
  3. Invoke the CallableStatement.registerOutParameter method to register the data types of parameters that are defined as OUT in the CREATE PROCEDURE statement. The driver data type for cursor type output parameters is com.ddtek.jdbc.extensions.ExtTypes.CURSOR.
  4. Call the stored procedure.
  5. Invoke the CallableStatement.getObject method to retrieve the ResultSet for each OUT cursor parameter. Calling CallableStatement.getString returns a name that is associated with the result set that is returned for the parameter. You can call only CallableStatement.getObject or CallableStatement.getString on a cursor parameter.
  6. Retrieve rows from the ResultSet object for each OUT cursor parameter.
  7. Close the ResultSet.