Hi,
As far as I know HSQLDB don't put the code into the database, use an
classpath:fullName spec for any type of Java routine, and by default,
the static methods of any class that is on the classpath are available
to be used.
Look at: http://hsqldb.org/doc/2.0/guide/sqlroutines-chapt.html#N1259B
Regards
Dario
El 24/06/10 01:41, Kerry Sainsbury escribió:
>
> I don't see that HSQLDB supports having the Java within the database
> for use by triggers.
>
> ... but I don't see how you can define "org.hsqldb.test.TriggerClass"
> apart from by putting a compiled Java class on the classpath.
>
The body of a Java language routine is a static method of a Java class,
specified with a fully qualified method name in the routine definition.
In the example below, the static method named |toZeroPaddedString| is
specified to be called when the function is invoked.
CREATE FUNCTION zero_pad(x BIGINT, digits INT, maxsize INT)
RETURNS CHAR VARYING(100)
NO SQL
LANGUAGE JAVA PARAMETER STYLE JAVA
EXTERNAL NAME
'CLASSPATH:org.hsqldb.lib.StringUtil.toZeroPaddedString'
Securing Access to Classes
By default, the static methods of any class that is on the classpath are
available to be used. This can compromise security in some systems. The
optional Java system property |hsqldb.method_class_names| allows
preventing access to classe other than |java.lang.Math| or specifying a
semicolon-separated list of allowed classes. In the example below, the
property has been included as an argument to the java command.
java -Dhsqldb.method_class_names="org.me.MyClass;org.you.YourClass" [the
rest of the command line]
The above example allows access to the methods in the two classes
only: |org.me.MyClass| and org.you.YourClass. Note that if the property
is not defined, no access control is performed at this level.
Once the routine has been defined, the normal database access control
still applies. The routine can be executed only by the users who have
been granted EXECUTE privileges on it. The user who executes a Java
routine must also have the relevant access privileges on the tables that
are used inside the Java method.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.