1.1.1

Table Of Contents
In this example application, the getJarBytes() method would be implemented in the following way:
public static byte[] getJarBytes(String jar) throws Exception {
FileInputStream fis = new FileInputStream(jar);
byte[] data = new byte[4096];
int len;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
while ((len = fis.read(data)) != -1) {
bos.write(data, 0, len);
}
return bos.toByteArray();
}
SQLFire automatically loads the installed JAR le class into its class loader; you do not need to explicitly load
classes after installing the JAR.
Replacing a JAR File with SQLJ.REPLACE_JAR
Execute the SQLJ.REPLACE_JAR procedure on a SQLFire member to replace a JAR le. For example, the
following procedure replaces the JAR contents of the loaded APP.Sample1 JAR installation with the contents
of the newtours.jar le.
call sqlj.replace_jar(
'c:\myjarfiles\newtours.jar', 'APP.Sample1');
When you replace a JAR le, SQLFire loads the new classes right away without your having to reboot.
Removing an Installed JAR File with SQLJ.REMOVE_JAR
Execute the SQLJ.REMOVE_JAR procedure on a SQLFire member to remove an installed JAR le. For example,
the following command removes the class les associated with the APP.Sample1 JAR installation:
call sqlj.remove_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.
129
Storing and Loading JAR Files in SQLFire