I have created a java stored procedure in DB2 using the development center. Building it produces the following pl/sql:

CREATE PROCEDURE DB2ADMIN.READZIPCODE ( IN addressData CHARACTER(32),
OUT zipcode CHARACTER(32) )
SPECIFIC SQL040901161316545
NOT DETERMINISTIC
LANGUAGE Java
EXTERNAL NAME 'DB2ADMIN.SQL40801041244480:READZIPCODE.rEADZIPCOD E'
FENCED
THREADSAFE
PARAMETER STYLE JAVA


The java looks like the following:


/**
* JDBC Stored Procedure DB2ADMIN.READZIPCODE
* @param AddressData
* @param zipcode
*/
import java.sql.*; // JDBC classes

public class READZIPCODE
{

/**
* Used to identify the zip string,
* it's value is {@value}
*/
public static final String kZIP = "ZIP=";

/**
* Used to identify the equals string,
* it's value is {@value}
*/
public static final String kEQUALS = "=";


public static void rEADZIPCODE ( String addressData,
String[] zipcode) throws SQLException

{


int endOfString = addressData.length();

int startZip = addressData.indexOf(kZIP);

int end = addressData.indexOf(kEQUALS, startZip + 1);

zipcode[0] = addressData.substring(end + 1, endOfString);
}
}


I call it from db2 using the command:

call DB2ADMIN.READZIPCODE('CITY=WashingtonSTATE=VAZIP=1 0009', ?);

and get the following error:


SQL4306N Java stored procedure or user-defined function
"DB2ADMIN.READZIPCODE", specific name "SQL040901161316545"
could not call Java method "rEADZIPCODE", signature
"(Ljava/lang/String".

Explanation:

The Java method given by the EXTERNAL NAME clause of a CREATE
PROCEDURE or CREATE FUNCTION statement could not be found. Its
declared argument list may not match what the database expects,
or it may not be a "public" instance method.

User Response:

Ensure that a Java instance method exists with the "public" flag
and the expected argument list for this call.

sqlcode : -4306

sqlstate : 42724



The java method exists and is public and the expected arguments are called. The jar is under the
SQLLIB\FUNCTION\jar\DB2ADMIN directory which exists in the classpath. Any ideas what to try from here.

Thanks,
Martin