1.0

Table Of Contents
Restrictions for Managing JAR Files Using System Procedures
To use the SQLJ.INSTALL_JAR or SQLJ.REPLACE_JAR procedure, the JAR le path must be available on
the specic SQLFire data store to which the client is connected. If the client connects directly to a known SQLFire
server, then only that server requires the JAR le to be available at the specied path when the procedure executes.
However, if the client connects using a locator then it may be connected to any available server in the distributed
system. In this case, the JAR le path should be available to all members of the SQLFire cluster (for example,
from a leshare location such as z:\) to ensure that the procedure can execute.
Note: If you cannot provide a common JAR location to ensure that SQLJ.INSTALL_JAR or
SQLJ.REPLACE_JAR executes, use the sqlf commands described in Manage JAR Files in SQLFire on
page 112 or manually inject the JAR le into the SQLFire system as described in Installing a JAR File
Directly into SYS.JARS on page 114 .
Installing a JAR File with SQLJ.INSTALL_JAR
To install a JAR le to SQLFire, connect to a SQLFire member and execute the install_jar procedure. For
example, the following procedure installs the tours.jar le to the APP schema, from a leshare location:
call sqlj.install_jar(
'z:\tours.jar', 'APP.Sample1', 0)
Note: The nal integer argument species an alias for the JAR le. However, SQLFire ignores this
argument, so it is normally set to 0.
The second argument denes an identier for the JAR le in the SQLFire system. You must include a schema
name to qualify the identier. You can use the JAR identier at a later time with the SQLJ.REPLACE_JAR and
SQLJ.REMOVE_JAR procedures.
You can optionally specify a quoted identier for the SQLFire JAR name:
call sqlj.install_jar(
'z:\tours.jar', 'APP."Sample2"', 0)
After installing the JAR, SQLFire automatically loads the JAR le classes into its class loader; you do not need
to explicitly load classes after installing the JAR. The JAR and its classes are available to all members of the
SQLFire distributed system, including those that later join the cluster.
Note: After you install a JAR le, you cannot modify any of the individual classes or resources within
the JAR le. Instead, you must replace the entire JAR le to update a class.
Installing a JAR File Directly into SYS.JARS
If the JAR le to install is not available to every data store member in the SQLFire cluster, inject the JAR le
directly from the client into the SQLFire system using Java code.
The SYS.JARS table stores installed JAR les, and you can insert a new JAR into this table as a byte[] value.
For example, an application can use code similar to the following to add a JAR to the SYS.JARS table:
byte[] jarBytes = getJarBytes(myjar);
String sql = "insert into SYS.JARS values(?, ?)";
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, "app.sample1");
ps.setBytes(2, jarBytes);
ps.executeUpdate();
vFabric SQLFire User's Guide114
Developing Applications with SQLFire