Okay, Buck. I get it. You're trying to write a stored procedure in
Java. I thought you were trying to access the database using JDBC from
a java program. That was what I sent you the URLs for.
This is something else.
Gary
> -----Original Message-----
> From: java400-l-admin@midrange.com
> [mailto:java400-l-admin@midrange.com] On Behalf Of Buck Calabro
> Sent: Tuesday, August 13, 2002 12:04 PM
> To: java400-l@midrange.com
> Subject: IBM SP example (was How can I find out what JAR file
> has a class?)
>
>
> >Sorry, I've never heard of the StoredProcedure class.
>
> Don't sweat it my friend. It's all new and kinky to me. I
> also misspelt it. It's StoredProc, not that it matters.
> Prowling through db2_classes shows there's no 'Stored'
> anything in there.
>
> >What is it's fully qualified name (with the package).
> >Where did you find out about this class. I don't think
> >there is such a thing in standard JDBC.
>
> Beats me if it's standard JDBC or not.
> SQL Concepts, V5R1 pp 158-161, Considerations for SP's
> written in Java. Especially the section on DB2GENERAL
> parameter style. The following is copy/pasted directly from
> that manual.
>
> o The class which defines a Java stored procedure
> must ?extend?, or be a subclass of, the Java
> com.ibm.db2.app.StoredProc class.
> o The Java method must be a public void instance method.
> o The parameters of the Java method must be
> SQL-compatible types.
> o A Java method may test for a SQL NULL value
> using the isNull( ) method.
> o The Java method must explicitly set the return
> parameters using the set( ) method.
> o The Java method may access the current database
> using the getConnection ( ) method.
> o The compiled class file must reside in the
> /QIBM/UserData/OS400/SQLLib/Function directory.
>
> package mystuff;
>
> import com.ibm.db2.app.*;
> import java.sql.*;
>
> public class sample2 extends StoredProc {
> public void donut(String query, int rowCount,
> String sqlstate) throws Exception {
> try {
> Statement s=getConnection().createStatement();
> ResultSet r=s.executeQuery(query);
> int counter=0;
> while(r.next()){
> counter++;
> }
> r.close(); s.close();
> set(2, counter);
> }catch(SQLException x){
> set(3, x.getSQLState());
> }
> }
> }
>
> --buck