USING DB2 from a JZOS BATCH job

This forum can be used to discuss using the open source Eclipse IDE to develop z/OS Java applications.
Post Reply
hollobg
Posts: 4
Joined: Wed Nov 28, 2012 5:39 pm

USING DB2 from a JZOS BATCH job

Post by hollobg » Mon Dec 10, 2012 3:58 pm

I was doing exercise 11.5 from the JZOS COOKBOOK about accessing DB2 from a JZOS batch job. In ECLIPS in the build.properties of ant.src I have the following:
db2ClassesDir = /product/db2v81a/usr/lpp/db2810/jcc/classes
db2LibDir = /product/db2v81a/usr/lpp/db2810/jcc/lib
We are still running DB2 V8. I updated the context.xml and dao-jdbc.xml as described in the cookbook,, then uploaded the changes using ant. When I ran job RUNINVEN, the SYSOUT OUTPUT gave the following:
JVMJZBL1006I LANG = C
JVMJZBL1006I LIBPATH = /product/db2v81a/usr/lpp/db2810/jcc/lib:/lib:/usr/lib:/usr/lpp/java/J5.0/bin:/usr/lpp/
in/classic:/usr/lpp/java/J6.0/bin
JVMJZBL1006I _BPX_SHAREAS = YES
JVMJZBL1006I JAVA_DUMP_HEAP = false
JVMJZBL1006I TZ = CST6CDT
JVMJZBL1006I MANPATH = /usr/man/%L
JVMJZBL1006I NLSPATH = /usr/lib/nls/msg/%L/%N
JVMJZBL1006I PWD = /u/SPBHOLL
JVMJZBL1012I Java Virtual Machine created. Version information follows:
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pmz31devifx-20100215 (SR11 FP1 ))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 z/OS s390-31 j9vmmz3123ifx-20100127a (JIT enabled)
J9VM - 20100122_52103_bHdSMr
JIT - 20091016_1845ifx1_r8
GC - 20091026_AA)
JVMJZBL1049W JZOS batch Launcher Version '2.3.0 2009-10-08' does not match jzos.jar Version '2.3.0 2008-05-12
JVMJZBL1027I Using output encoding: IBM-1047
JVMJZBL1016I MVS commands are ENABLED
JVMJZBL1023N Invoking com.ibm.jzos.cookbook.inventory.BatchProcessor.main()...
JVMJZBL2010E Exception occurred invoking com.ibm.jzos.cookbook.inventory.BatchProcessor.main()
JVMJZBL2007E Stack trace follows:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception i
com.ibm.db2.jcc.c.SqlException: Failure in loading T2 native library db2jcct2zos, reason: java.lang.Unsatisf
: db2jcct2zos (Not found
in java.library.path)
Caused by: com.ibm.db2.jcc.c.SqlException: Failure in loading T2 native library db2jcct2zos, reason:
java.lang.UnsatisfiedLinkError: db2jcct2zos (Not found in java.library.path)
at com.ibm.db2.jcc.t2.a.a(a.java:31)
at com.ibm.db2.jcc.t2zos.T2zosConfiguration.e(T2zosConfiguration.java:664)
at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(T2Configuration.java:71)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:196)
at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:181)
at java.sql.DriverManager.getConnection(DriverManager.java:572)
at java.sql.DriverManager.getConnection(DriverManager.java:165)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManager
ava:291)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManager
Do you know what Im doing wrong?. . . . . . . . . . .

dovetail
Site Admin
Posts: 1813
Joined: Thu Jul 29, 2004 12:12 pm

Re: USING DB2 from a JZOS BATCH job

Post by dovetail » Tue Dec 11, 2012 11:47 am

What do you have for the following properties ?

# z/OS DB2 Settings
# Set "noDB2" to "*" if you don't have DB2 libraries (this is the default).
# otherwise set it to nothing (uncomment the following line, comment the one after)
# and configure the remaining DB2 properties
#noDB2 =
noDB2 = *
db2Schema = ${userid}
db2Subsystem = DSN9
db2ClassesDir = /usr/lpp/db2910/db2910_jdbc/classes
db2LibDir = /usr/lpp/db2910/db2910_jdbc/lib
db2Hlq = DSN910
db2SpufiPlan = DSNTIA91
db2Runlib = ${db2Hlq}.RUNLIB.LOAD
sdsnExit = ${db2Hlq}.SDSNEXIT
sdsnLoad = ${db2Hlq}.SDSNLOAD
sdsnLod2 = ${db2Hlq}.SDSNLOD2


If this is set up correctly, then your JCL should have a JOBLIB contatenation that contains SDSNEXIT, SDSNLOAD, and SDSNLOD2. The error that you are getting seems to indicate that you don't have these in a joblib or steplib.

hollobg
Posts: 4
Joined: Wed Nov 28, 2012 5:39 pm

Re: USING DB2 from a JZOS BATCH job

Post by hollobg » Tue Dec 11, 2012 5:56 pm

In the build.properties of ant.src I have the following:
# z/OS DB2 Settings
# Set "noDB2" to "*" if you don't have DB2 libraries (this is the default).
# otherwise set it to nothing (uncomment the following line, comment the one after)
# and configure the remaining DB2 properties
noDB2 =
#noDB2 = *
db2Schema = ${userid}
db2Subsystem = DBS0
db2ClassesDir = /product/db2v81a/usr/lpp/db2810/jcc/classes
db2LibDir = /product/db2v81a/usr/lpp/db2810/jcc/lib
db2Hlq = SYSP.DB2V81B.DSN
db2SpufiPlan = DSNTIA81
db2Runlib = ${db2Hlq}.RUNLIB.LOAD
sdsnExit = SYSP.DBS0.SDSNEXIT
sdsnLoad = ${db2Hlq}.SDSNLOAD
sdsnLod2 = ${db2Hlq}.SDSNLOD2
for ${userid} I have:
# The z/OS userid: must be in UPPERCASE
userid = SPBHOLL
For java:
# JZOSVM version: 50, 56, 60, 66
javaVM = 60

# The z/OS Java SDK 5 home directory
zosJavaHome = /usr/lpp/java/J6.0

# The z/OS directory containing the JZOS alphaWorks libraries
jzosHome = /usr/lpp/java/J6.0/bin
In context.xml I have
<!-- Uncomment *one* of the following data access configurations-->
<import resource="dao-jdbc.xml" />
<!--
<import resource="dao-jdbc.xml" />
<import resource="dao-vsam.xml" />
<import resource="dao-mem.xml" />
-->
In dao-jdbc.xml I have:
<!-- Configure a DataSource for z/OS DB2 type 2 (local) driver.
To use DB2, comment out (disable) the other dataSources,
and uncomment the following bean.
- replace "LOC1" with your DB2 z/OS location name,
- replace "MYSCHEMA" with the id that you used in
for build.properties: ${db2Schema}. -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource" >
<property name="driverClassName"
value="com.ibm.db2.jcc.DB2Driver"/>
<property name="url"
value="jdbc:db2:10.5.26.15;currentSchema=SPBHOLL"/>
</bean>
I ran the ant script uploadall. In the JZOSENV member I have:
# Add DB2 jars to the CLASSPATH if present
if Ý -d /product/db2v81a/usr/lpp/db2810/jcc/classes ¨
then
for i in /product/db2v81a/usr/lpp/db2810/jcc/classes/*.jar; do
export CLASSPATH="$CLASSPATH":"$i"
done
fi

# Add DB2 libs to LIBPATH if present
if Ý -d /product/db2v81a/usr/lpp/db2810/jcc/lib ¨
then
export LIBPATH=/product/db2v81a/usr/lpp/db2810/jcc/lib:"$LIBPATH"
fi

I have a JOBLIB in jcl member RUNINVEN I have:
//JOBLIB DD DSN=SYSM.DBS0.SDSNEXIT,DISP=SHR
// DD DSN=SYSP.DB2V81B.DSN.SDSNLOAD,DISP=SHR
// DD DSN=SYSP.DB2V81B.DSN.SDSNLOD2,DISP=SHR
//*
And I authorized all these libraries, neverless Im still getting the error:
JVMJZBL2007E Stack trace follows:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection;
com.ibm.db2.jcc.c.SqlException: Failure in loading T2 native library db2jcct2zos, reason:
: db2jcct2zos (Not found
in java.library.path)
Caused by: com.ibm.db2.jcc.c.SqlException: Failure in loading T2 native library db2jcct2zo
java.lang.UnsatisfiedLinkError: db2jcct2zos (Not found in java.library.path)
at com.ibm.db2.jcc.t2.a.a(a.java:31)
I dont quite know what db2jcct2zos is?

dovetail
Site Admin
Posts: 1813
Joined: Thu Jul 29, 2004 12:12 pm

Re: USING DB2 from a JZOS BATCH job

Post by dovetail » Tue Dec 11, 2012 7:50 pm

I'm sorry, I'm not sure what your problem is.
You might have to ask IBM for help in diagnosing the problem - with the IBM DB2 Java connector.

Post Reply