Creating Java stored procedures from Java methods

If you develop a Java application that accesses a database by using pureQuery, SQLJ, or JDBC, you can create Java stored procedures from methods in the Java project.

Before you begin

Before you can create Java stored procedures from methods in Java projects, you must configure the necessary prerequisites.

After you create a Java stored procedure, you can deploy, run, and perform other operations on it in the Java perspective as well as in the SQL and Routine Development perspective. If the Java stored procedure is in a Java application that is enabled for pureQuery, you can also bind the application to a DB2® database.

About this task

To create a Java stored procedure from a method in a Java project:

Procedure

  1. Refactor the method code so that it can be used to invoke the stored procedure.
  2. Create the Java stored procedure.
  3. Optional: If you do not select the deploy option when you create the Java stored procedure, deploy the stored procedure.
  4. Optional: If you create the Java stored procedure in a Java application that uses pureQuery to access a DB2 database, bind the application to the database.
  5. Run the Java stored procedure.

Feedback