Home | Previous Page | Next Page   Creating Java User-Defined Routines >

Using a Deployment Descriptor

A deployment descriptor allows you to include in a JAR file the SQL statements for creating and dropping the UDRs. Both sqlj.install_jar() and sqlj.remove_jar() take parameters that, when set appropriately, cause the procedure to search for deployment descriptor files in the JAR file.

You can include the following SQL statements in a deployment descriptor:

When you execute sqlj.install_jar() or sqlj.remove_jar(), the database server automatically performs the actions described by any deployment-descriptor files that exist in the JAR file.

Warning:
The transaction handling of the current database controls the SQL statements that the deployment descriptor executes. Use a BEGIN WORK statement to begin a transaction before you execute the sqlj.install_jar() or sqlj.remove_jar() procedure. In this way, a successful deployment can be committed, while a failed deployment can be rolled back.

For example, you might prepare a file, deploy.txt, that includes the following statements:

SQLActions[] = {
"BEGIN INSTALL
   CREATE PROCEDURE showusers()
      WITH (class='jvp')
      EXTERNAL NAME 'thisjar:admin.showusers()'
      LANGUAGE JAVA;
   GRANT EXECUTE ON PROCEDURE showusers() to informix;
END INSTALL",

"BEGIN REMOVE
   DROP PROCEDURE showusers();
END REMOVE"

For details on deployment-descriptor files, refer to the SQLJ: SQL Routines specification.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]