Once you have written, compiled, and tested the Java code for your SQL functions, you can load them into the database. You load user-defined functions the same way you load stored procedures, by packaging the Java class or classes into a JAR file and then loading the JAR file using the LOAD CLASSES statement. For example:
$ export CLASSPATH="$CLASSPATH:/opt/voltdb/voltdb/*" $ javac -d ./obj src/myapp/functions/*.java $ jar cvf myfunctions.jar -C obj . $ sqlcmd 1> load classes myfunctions.jar;
You can package multiple function methods and classes or a combination of functions and stored procedure classes into a single JAR file. The key is that you must load the classes containing the aggregate functions and scalar function methods into the database before you can declare them as SQL functions.