Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

9.3.1 Sample program

This section presents an example of a stored procedure that uses the SELECT statement to retrieve BLOB data stored in the pics table, zips the data (compresses the data in the ZIP format), then returns it to the calling program.

Explanation
  1. Defines the procedure name and parameters.
  2. Specifies LANGUAGE.
  3. Associates with the Java method.
  4. Specifies PARAMETER STYLE.

Explanation
  1. Defines the class name.
  2. Defines the method name and parameter name.
  3. Defines an action to be taken in the event of an exception.
  4. Obtains the Connection object.
  5. Preprocesses the SELECT statement.
  6. Executes the SELECT statement and obtains the result set.
  7. Declares variables.
  8. Obtains the value of the p_name column from the result set.
  9. Obtains the value of the p_data column from the result set.
  10. Compresses the data in the srcPic array in the ZIP format and stores it in the zos stream.
  11. Closes the input and output streams.
  12. Specifies the byte column of the baos stream in the method's OUT parameter.
  13. End of method execution.

Explanation
  1. Defines the class name.
  2. Defines the method name and parameter name.
  3. Defines an action to be taken in the event of an exception.
  4. Obtains the Connection object.
  5. Preprocesses the CALL statement.
  6. Executes the CALL statement.
  7. Obtains the OUT parameter of the byte array type.