Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
*
The moose likes JDBC and the fly likes Pointbase : How can I create a stored procedures with Pointbase database? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Pointbase : How can I create a stored procedures with Pointbase database?" Watch "Pointbase : How can I create a stored procedures with Pointbase database?" New topic
Author

Pointbase : How can I create a stored procedures with Pointbase database?

Sebastien Muller
Greenhorn

Joined: Mar 05, 2010
Posts: 3
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!









Sebastien Muller
Greenhorn

Joined: Mar 05, 2010
Posts: 3
Hello,

I have tryed to start from my database CLASSPATH, I think that is better, but I have still some problems.
Now I copy my class SampleExternalMethods in C:\Sun\AppServer\pointbase\lib and after I run these commands:

set classpath=C:\Sun\AppServer\pointbase\lib\pbclient.jar
set classpath=%classpath%;C:\Sun\AppServer\pointbase\lib

C:\Sun\AppServer\pointbase\lib -Djdbc.drivers=com.pointbase.jdbc.jdbcUniversalDriver SampleExternalMethods

I have this error message:

C:\Sun\AppServer\pointbase\lib>java -Djdbc.drivers=com.pointbase.jdbc.jdbcUniver
salDriver SampleExternalMethods
java.sql.SQLException: Cannot create Store Procedure GETCOUNTRY. java.security.A
ccessControlException: access denied (com.pointbase.sp.spPermission SampleExtern
alMethods).
at com.pointbase.net.netJDBCPrimitives.handleResponse(DashoA13*..:370)
at com.pointbase.net.netJDBCPrimitives.handlePrimitiveResponse(DashoA13*
..:473)
at com.pointbase.net.netJDBCStatement.executeUpdate(DashoA13*..:196)
at SampleExternalMethods.doCreateProcedure(SampleExternalMethods.java:97
)
at SampleExternalMethods.main(SampleExternalMethods.java:21)

May be have you an idea?

Thank you in advance.

cagou27!

Sebastien Muller
Greenhorn

Joined: Mar 05, 2010
Posts: 3
Hello,

apparently my problem is not a JDBC problem. In fact, I have a problem with the Java Security Manager. It is explained in this note:

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 know where is the java policy file and this is his code:



I must grant
’com.pointbase.sp.spPermission’ to the class that implements the external Java method.

My idea is to write:



But I'm not sure, can you confirm that?

Thank you in advance.

cagou27!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pointbase : How can I create a stored procedures with Pointbase database?