db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edward Rayl <er...@bellsouth.net>
Subject Stored function problems
Date Thu, 23 Sep 2004 01:22:06 GMT
I'm trying to create a stored function in Derby and call it from either 
ij or Java.  The class I created is:

package oi;
import java.sql.*;
public class Derby
{
    public static String buildEmail(String fname, String lname)
    {
        int length = lname.length();
        if (length > 7) length = 7;
        return new String(fname.substring(0, 1) + lname.substring(0, length)).toLowerCase();
    }
}


I've compiled this and JARed it in derbyprocs.jar.  I've also put 
derbyprocs.jar on the classpath.  Next, after creating a schema called 
earthlings,  I ran this from ij:

ij> call sqlj.install_jar('/OI/JDBC/lib/derbyprocs.jar', 'earthlings.derbyprocs', 0);
0 rows inserted/updated/deleted

ij> create function earthlings.build_email (firstname varchar(20), lastname varchar(30))
returns varchar(8)
language java
external name 'oi.derby.buildEmail'
parameter style java
no sql
returns null on null input;
0 rows inserted/updated/deleted

ij> values earthlings.build_email('John', 'Smith');
ERROR 42X51: The class 'oi.derby' does not exist or is inaccessible. This can ha
ppen if the class is not public. (errorCode = 30000)
ERROR XJ001: Java exception: 'oi.derby: java.lang.ClassNotFoundException'. (erro
rCode = 30000)


What have I misunderstood or missed?

Ed


Mime
View raw message