db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vitalik <tiks...@gmail.com>
Subject stored procedure without storing jar in database
Date Wed, 14 Oct 2009 13:38:04 GMT
Hi!

As said in http://wiki.apache.org/db-derby/DerbySQLroutines, it is not
necessary to load jar files in database to create stored procedures.
If jar is in application classpath it is enought. But I have a trouble
when I try to call my stored procedure from ij.
So I try this:

1. Write java class test.MyClass with method public static void
testMethod(int p1, int p2)
2. Compile storedprocs.jar with MyClass inside
3. Create stored proc in database

CREATE PROCEDURE testProc(IN KW1 INTEGER, IN KW2 INTEGER)
PARAMETER STYLE JAVA
MODIFIES SQL DATA
LANGUAGE JAVA
DYNAMIC RESULT SETS 0
EXTERNAL NAME 'test.MyClass.testMethod';

4. start ij with the script

@echo off
if defined DERBY_HOME (

 SET CLASSPATH=C:\projects\storedprocs.jar
 sysinfo -cp embedded test.MyClass.class
 java -Dclasspath=%CLASSPATH% -Dij.connection.mydb=jdbc:derby:mydb"
-jar "%DERBY_HOME%\lib\derbyrun.jar" ij

) else (
ECHO DERBY_HOME is not defined!
)

sysinfo -cp embedded test.MyClass.class tells me that MyClass is in classpath.

but when I try to call procedure I get an exception
> > > > > ERROR 42X51: The class 'test.MyClass' does not exist or is inaccessible.
This can happen if the class is not public.
ERROR XJ001: Java exception: 'test.MyClass: java.lang.ClassNotFoundException'.

So the question is in that how create stored procedure without storing
jar in database.
Thanks!

-- 
King regards, Vitalik

Mime
View raw message