Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003

    Unanswered: sqlj & updatejarinfo

    Ever tried scripting the creation of java stored procs on db2 and been successful at all but getting the class source to be updated in sysibm.sysjarcontents?

    I succeeded in inserting the class source (from the original .java file) into
    sysibm.sysjarcontents.class_source just today. I actually called
    sqlj.updatejarinfo via OLEDB using a short VB sub:

    Sub ProcUpdateJar(jarid, classid, jarurl)
    Dim cxn, prc, pjarid, pclassid, pjarurl

    Set cxn = CreateObject("ADODB.Connection")
    cxn.Open "Provider=IBMDADB2;Data Source=SDPROD1;"

    Set prc = CreateObject("ADODB.Command")
    prc.CommandTimeout = 300
    prc.ActiveConnection = cxn
    prc.CommandType = adCmdStoredProc
    prc.CommandText = "sqlj.updatejarinfo"
    Set pjarid = prc.CreateParameter("jar-id", adVarChar, adParamInput, 128,
    jarid) 'required
    Set pclassid = prc.CreateParameter("class-id", adVarChar, adParamInput,
    128, classid) 'required
    Set pjarurl = prc.CreateParameter("jar-url", adVarChar, adParamInput,
    128, jarurl) 'required
    prc.Parameters.Append pjarid
    prc.Parameters.Append pclassid
    prc.Parameters.Append pjarurl

    Set pjarid = Nothing
    Set pclassid = Nothing
    Set pjarurl = Nothing

    Set prc = Nothing
    End Sub

    This worked for me executed from a VBA module in MS Access on a Win2k machine.

    The DB2 instance version is DB2/6000 8.1.5.

    The jarid was

    The classid was

    The source file was located on the db2 host filesystem at

    The sub was executed from the client system with
    ProcUpdateJar "SDT001.PROCTEST","PROCTEST","file:/db2inst/ts/work/"

    Though as yet untested, I assume this would work just as well similarly called from C/C++, java, etc. Pure speculation is there is an imcompatibility somewhere in the CLP interface that is bypassed when sqlj.updatejarinfo is called via the OLE/DB interface instead.

    Let me know if you adapt it to java or something else I might be able to
    execute from command-line - I'll probably try java next myself, otherwise
    compile a quick .exe from the VB.

    Hope this helps.

    Tim Erickson

  2. #2
    Join Date
    Oct 2003

    java class to updatejarinfo

    import java.lang.*;
    import java.sql.*;

    class clUpdateJarInfo {
    public static void main (String[] args) throws SQLException, ClassNotFoundException {
    Connection cxn = DriverManager.getConnection("jdbc:db2DPROD1");
    CallableStatement cs;

    //thanks to
    //for the jumpstart on this code

    cs = cxn.prepareCall("{call sqlj.updatejarinfo(?, ?, ?)}");
    cs.setString(1, args[0]);
    cs.setString(2, args[1]);
    cs.setString(3, args[2]);

Posting Permissions

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