Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2004
    Posts
    10

    Unanswered: SQL4304N Error - DB2 UDB 7.2 FixPack 12

    Hi all.,

    I have a problem trying to execute a Java Stored Procedure after update to the fixpack 12

    db2 call valoriva(747,?)

    SQL4304N Java stored procedure or user-defined function "DACADM .VALORIVA", specific name "SQL030722125801570" could not load Java class "ImpuestoDescuento", reason code "4". SQLSTATE=42724


    I review the error code:
    ----------------------------------------------------------
    D:\>db2 ? sql4304N

    SQL4304N Java stored procedure or user-defined function
    "<name>", specific name "<spec-name>" could not load
    Java class "<class>", reason code "<reason-code>".

    Explanation: The Java class given by the EXTERNAL NAME clause of
    a CREATE PROCEDURE or CREATE FUNCTION statement could not be
    loaded. The reason codes are:


    1 The class was not found on the CLASSPATH.

    2 The class did not implement the required interface

    3 The default constructor failed or was unavailable.

    4 Could not load driver for "jdbc:default:connection".

    5 Could not establish default context.

    User Response: Ensure that the compiled ".class" file is
    installed in the CLASSPATH, for example under "sqllib/function".
    Ensure it implements the required Java interfaces and is
    "public".

    sqlcode: -4304

    sqlstate: 42724
    -----------------------------------------------------------


    I review the CLASSPATH, and it's OK:

    ------CLASSPATH-------------

    D:\>echo %CLASSPATH%
    C:\j2sdk1.4.1_02\bin;D:\Archivos de programa\IBM\WebSphere MQ\Java\lib\provideru
    til.jar;D:\Archivos de programa\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar;D:\A
    rchivos de programa\IBM\WebSphere MQ\Java\lib\ldap.jar;D:\Archivos de programa\I
    BM\WebSphere MQ\Java\lib\jta.jar;D:\Archivos de programa\IBM\WebSphere MQ\Java\l
    ib\jndi.jar;D:\Archivos de programa\IBM\WebSphere MQ\Java\lib\jms.jar;D:\Archivo
    s de programa\IBM\WebSphere MQ\Java\lib\connector.jar;D:\Archivos de programa\IB
    M\WebSphere MQ\Java\lib\fscontext.jar;D:\Archivos de programa\IBM\WebSphere MQ\J
    ava\lib\com.ibm.mq.jar;.;D:\Archivos de programa\SQLLIB\java\db2java.zip;D:\Arch
    ivos de programa\SQLLIB\java\runtime.zip;D:\Archivos de programa\SQLLIB\bin;D:\Archivos de programa\SQLLIB\function\export.jar;D:\Archivos de programa\SQLLIB\function\function.zip
    -------------------------------------------------------

    But in the db2diag.log appear the following error:

    ------------------------------------------------------------
    2004-07-15-15.52.35.578000 InstanceB2 Node:000
    PID:2420(db2dari.exe) TID:3564 Appid:
    BSU Java support sqlejLogException Probe:10

    java.lang.NoClassDefFoundError: COM/ibm/db2/jdbc/app/DB2StoredProcDriver


    2004-07-15-15.52.35.625000 InstanceB2 Node:000
    PID:2420(db2dari.exe) TID:3564 Appid:
    BSU Java support sqlejCallSTP Probe:30

    Error from DB2JEXT CallSTP. RC:
    30ef ffff 0...
    ----------------------------------------------------------

    Anybody have a solution for this problem??

    Thank's and Regards for any help.

  2. #2
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    Make sure you've run the "db2iupdt" command for the instance, maybe there's some mis-match between the class defs.
    --
    Jonathan Petruk
    DB2 Database Consultant

  3. #3
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    I suspect you've used one of the IBM documentation samples to build your stored procedure. I have an impression they (IBM) haven't updated their sample code for a while - the trick they use to obtain a database connection doesn't work.

    Try the following approach:
    1) Make your stored procedure to extend from COM.ibm.db2.app.StoredProc (which you should have done anyway)
    2) Use StoredProc.getConnection() method (it is implemented in the super-class) to obtain the connection.

    It works for me with JDK 1.3.1 and DB v7.2 (fixpacks 6 through 12, Win32 and AIX)

  4. #4
    Join Date
    Jun 2004
    Posts
    10
    Thank's so for your responses.,

    I have DB2 over Windows 2000 Server, "db2iupdt" runs over Linux.

    I will implement your suggestion to solve this problem extending the COM.ibm.db2.app.StoredProc., i hope that this resolve my problem.

    Thank you so much.


    May be you known above a problem in OLAP with this version of DB2?


    Regards

  5. #5
    Join Date
    Jun 2004
    Posts
    10

    Error SQL4304N - DB2 UDB 7.2 FixPack 12

    Hello.,

    I implement the extension but receive the same error code., may be help me with any suggestion in the following source code:

    Regards.

    --------------------ImpuestoDescuento.java--------------------------
    import java.sql.*;
    import COM.ibm.db2.app.StoredProc.*;
    public class ImpuestoDescuento extends COM.ibm.db2.app.StoredProc{
    /**
    * ImpuestoDescuento constructor comment.
    */
    public ImpuestoDescuento() {
    super();
    }
    /**
    * Insert the method's description here.
    * Creation date: (2003-05-02 08:22:04)
    * @param unOidEmpresa long
    * @param valor double
    */
    public static void valorIva(long unOidEmpresa, double[] valor) {
    try {

    //Connection con = DriverManager.getConnection("jdbc:default:connecti on");

    Connection con = new COM.ibm.db2.app.StoredProc().getConnection();
    String sql = "select iva from empresa where oid=?";

    PreparedStatement unPs = con.prepareStatement(sql);

    unPs.setLong(1,unOidEmpresa);

    ResultSet rs = unPs.executeQuery();

    if (rs.next())
    valor[0] = rs.getDouble("IVA");

    if (rs != null) rs.close();
    if (unPs != null) unPs.close();
    if (con != null) con.close();
    }
    catch(SQLException e){
    valor[0] =-1;
    }
    catch(Exception e1){
    valor[0] =-1;
    }

    }
    }

  6. #6
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    The CLASSPATH you sent us is from the Windows box... but Stored Procs run on the server and use the db2 instance CLASSPATH. Check it as well.
    --
    Jonathan Petruk
    DB2 Database Consultant

  7. #7
    Join Date
    Jun 2004
    Posts
    10
    Hi.,
    The CLASSPATH for the db2 instance is the same that i send you.

    Regards

  8. #8
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    Quote Originally Posted by dcazares
    Hi.,
    The CLASSPATH for the db2 instance is the same that i send you.

    Regards
    I thought it was on Linux?
    --
    Jonathan Petruk
    DB2 Database Consultant

  9. #9
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    1) What's the value of JDK11_PATH dbm configuration variable? (use "db2 get dbm cfg" to check)

    2) Have you set DB2_USE_JDK12 registry variable? (should be 1; use "db2set -all" to check)

    3) Have you run SQLLIB\java12\usejdbc2.bat?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •