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:
- CREATE FUNCTION
- CREATE PROCEDURE
- GRANT
- DROP FUNCTION
- DROP procedure
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.
Important: 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:
BEGIN INSTALL
CREATE PROCEDURE showusers()
EXTERNAL NAME 'thisjar:admin.showusers()'
LANGUAGE JAVA;
GRANT EXECUTE ON PROCEDURE showusers() to informix;
END INSTALL
BEGIN REMOVE
DROP PROCEDURE showusers();
END REMOVE
Note: The use of SQLActions[] syntax presented in earlier manuals is optional. You just need BEGIN
INSTALL/END INSTALL and BEING REMOVE/END REMOVE statements.
For details on deployment-descriptor files, refer to the SQLJ: SQL Routines specification.