Hello,
Excuse me for my english, I'm not anglophone. I try to create a stored procedure.
This is my file SampleExternalMethods.java :
Afterwards, I have read this note:
To invoke the dateConvert external Java method from a stored function, you must use the
CREATE FUNCTION statement. The dateConvert external Java method is called from the
class, SampleExternalMethods.
In order for the database to access this external Java method, the class SampleExternalMethods
must be included in the database CLASSPATH. For PointBase Embedded - Server Option, it
must be in the Server CLASSPATH, but not in the Client CLASSPATH.
If PointBase Server is run with the Java Security Manager, in the java policy file grant
’com.pointbase.sp.spPermission’ to the class that implements the external Java method.
An "spPermission" consists of a class name with no action. The class name is a name of a class
that could be used in creating a Stored Procedure in PointBase. The naming convention follows
the hierarchical property naming convention and that is supported by
"java.security.BasicPermission". An asterisk may appear by itself, or if immediately preceded
by ".", may appear at the end of the name, to signify a wildcard match. The name cannot
contain any white spaces.
I use a pointbase Server Option, but I didn't find the Server CLASSPATH. These are my files in the CLASSPATH:
C:\Sun\AppServer\pointbase\lib\
pbclient.jar
pbembedded.jar
pbtools.jar
pbupgrade.jar
I copy SampleExternalMethods into C:\Sun\AppServer\pointbase\lib\
and I try tu run
jar -uf pbembedded.jar SampleExternalMethods
, because I don't have a file pbserver.jar.
Afterwards I do that,
1) Start Pointbase
2) Configuration of classpath
set classpath=C:\Sun\AppServer\pointbase\lib\pbclient.jar
set classpath=%classpath%;D:\J2EE\Ch07Code\Ch07_06
I precise that my file SampleExternalMethods is into D:\J2EE\Ch07Code\Ch07_06\Ch07.
Then, I run the program:
D:\J2EE\Ch07Code\Ch07_06>
java -Djdbc.drivers=com.pointbase.jdbc.jdbcUniversalDriver Ch07.SampleExternalMethods
This is the error message:
Exception in thread "main" java.lang.NoClassDefFoundError: Ch07.SampleExternalMethods (wrong name: SampleExternalMethods)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.DefineClass(ClassLoader.java:539)
...
The problem, I suppose, comes from that the class SampleExternalMethods
must be included in the database CLASSPATH, but there is a pbserver.jar with pointbase normally, but I didn't find it. That's why I use pbembedded.jar in order to include the class SampleExternalMethods.
Please, can somebody help me?
Thank you in advance.
cagou27!