db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Briggs <acidbri...@gmail.com>
Subject Re: Installing and Using Java Procedures.
Date Thu, 24 Jan 2008 21:47:35 GMT
Hey, thanks for your reply.  I am still way confused on this.  And
trying to find examples of the SQL/JRT spec is almost impossible.  I
am trying to make some sense of the examples of creating store
procedures off the http://wiki.apache.org/db-derby/DerbySQLroutines
wiki page with no avail.  I am just trying to find the actual
rules/spec/documentation on doing this.

But, again, thanks for your help.





On Jan 24, 2008 4:23 PM, Daniel John Debrunner <djd@apache.org> wrote:
>
> Briggs wrote:
> > I'm having a bit of a problem installing a java procedure in derby
> > (10.3).  I thought I understood what I could do with them but now...
> >
> > I have created a simple "hello world" procedure:
> >
> > --------------
> >
> > package derby.proc;
> >
> > public class HelloWorldProcedure {
> >    public static String helloWorld(final String name) {
> >       return "hello " + name;
> >    }
> > }
> >
> > --------------
> >
> > Then created a jar file called DerbyProcs.jar in my temp directory
> > (with the above class).
> >
> > Then I run the following commands:
> >
> > CALL SQLJ.install_jar('c:\tmp\DerbyProcs.jar', 'APP.DERBY_PROCS', 0);
> >
> > CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.database.classpath','APP.DERBY_PROCS');
> >
> > CREATE PROCEDURE APP.HELLO_WORLD(
> >    IN NAME VARCHAR(20),
> >    OUT HELLO_YOU VARCHAR(30)
> > )
> > PARAMETER STYLE JAVA
> > READS SQL DATA
> > LANGUAGE JAVA
> > EXTERNAL NAME  'derby.proc.HelloWorldProcedure.helloWorld';
> >
> >
> > -- CALL THE PROC
> >
> > CALL APP.HELLO_WORLD('world');
> >
> >
> > The result I get is:
> >
> > Error code 30000, SQL state 42Y03: 'APP.HELLO_WORLD' is not recognized
> > as a function or procedure.
> > Line 13, column 1
> >
> >
> > What am I missing? Am I wrong on what I am expecting to happen?
>
> You defined an procedure that takes two arguments, but then only passed
> one, so no matching procedure will be found. Then as your later e-mail
> says this needs to be a function, OUT parameters are returned using one
> element arrays in the Java method's argument list.
>
> See:
>
> http://wiki.apache.org/db-derby/DerbySQLroutines
>
> this page has a list of useful topics:
>
> http://wiki.apache.org/db-derby/HintsAndTips
>
> Dan.
>



-- 
"Conscious decisions by conscious minds are what make reality real"

Mime
View raw message