I’m using libreoffice 7.3.4.2 on macOS 11.6.7 (Big Sur). I have created a database in Base using the embedded HSQL DB. Tables, queries, and forms are all working wonderfully.
I need to create some user-defined stored functions in java that will be called via SQL statements. Unfortunately, no matter what I’ve tried, I cannot get Base/embedded HSQL to execute the functions I have written in java. I have set the classpath within Base to include the JAR file in which my functions are located. Every time I try to call one of my functions using the “Execute SQL Statement” tool, I get the following error:
Access is denied: Myfuncs.trivial in statement [CALL “Myfuncs.trivial”(]
where “Myfuncs.trivial” is the name of the class and static function I am attempting to call.
I am able to call functions that are built in to java (e.g. java.lang.Math.sqrt), but I cannot call any functions that are in my JAR. Note that I can call my functions without any problems from other java code when my JAR is in java’s classpath, so I know that they actually work.
How does one get Base’s embedded HSQL DB to call user-defined java functions?
I’ve boiled things down to a very trivial test case:
CALL “Myfuncs.trivial”(2.0);
should call the following function which is in my JAR:
public final class Myfuncs {
public static double trivial( double d ) {
return java.lang.Math.sqrt( d );
}
}
For reference, the following works:
CALL “java.lang.Math.sqrt”(2.0);
However, trying to call Myfuncs.trivial always gives the “Access is denied” error.
Any help would be greatly appreciated.