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
prc.Execute
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
SDT001.PROCTEST
The classid was
PROCTEST
The source PROCTEST.java file was located on the db2 host filesystem at
/db2inst/ts/work/PROCTEST.java
The sub was executed from the client system with
ProcUpdateJar "SDT001.PROCTEST","PROCTEST","file:/db2inst/ts/work/PROCTEST.java"
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
http://www.in2words.org