To replace an archive file (specifically, a JAR or ZIP file) that was previously registered using the external stored procedure SQLJ.INSTALL_JAR, use the external stored procedure SQLJ.REPLACE_JAR.
The replacement archive file must contain a class file for every class file in the original archive file that has been referenced in the EXTERNAL NAME clause of a CREATE/REPLACE PROCEDURE or CREATE/REPLACE FUNCTION statement. Class files that are in the original archive file but are not referenced by an external routine can be removed from the replacement archive file. The replacement archive file can contain new class files.
If the definition of a replacement class does not match the original definition, then executing the external routine might produce unpredictable results. If the parameter list of a method that implements a Java external routine uses data types that do not match the data types of the original method, then an error is returned indicating that no matching Java method was found.
Any currently executing SQL statements that use the archive file continue to use the original JAR or ZIP file until execution is complete.
Before You Begin
Take the following steps before you replace a previously registered JAR or ZIP file for an external routine:
- Verify you have the EXECUTE privilege on the SQLJ.REPLACE_JAR external stored procedure.
- If the default database is not the same as the default database with which the archive file was registered, use the DATABASE statement to change the default database.
- Verify you have the DROP PROCEDURE or DROP FUNCTION privilege on any of the following objects:
- The default database
- The object that you are replacing within the default database, identified by the SQL identifier that was passed to SQLJ.INSTALL_JAR