Background:
Java connection and interaction with DB2 relational database table
You are NOT expected to have experience with Java to complete the challenge.
However, the Java code provided includes a working example of Java API to connect for read, write,
and update of a DB2 relational database table if you select to carefully review the syntax.
Challenge #08 assumes you successfully completed previous challenge.
You will learn to:
- Recognize Java code
- Compile Java code
- Execute Java code
- Modify Java code based upon recognizable Java code pattern
Several obstacles and tasks will be encountered to complete the challenge:
- Copy Java code from partitioned data set to unix file
- View Java compile failure related to insufficient virtual storage memory
- Increase TSO virtual storage to complete Java compile
- View Java execution failure related to authentication
- Modify Java code correcting issue with authentication failure
- Java program execution from Unix shell prompt
- Java program execution using JCL
Challenge:
Copy Java code from partitioned data set to unix file
- Jump to ISPF Command Shell panel =6
- oput 'zos.mtm2018.public.source(db2jdbc4)' 'db2jdbc4.java'
View Java compile failure related to insufficient virtual storage memory
- Jump to Unix Services command shell prompt =u
- javac db2jdbc4.java
Carefully reading the failure diagnostics written to the display indicates insufficient virtual storage.
Increase TSO virtual storage to complete Java compile
- Logoff ISPF/TSO
- Logon to TSO/ISPF with modification to SIZE value on TSO/E LOGON display
Change value from 32768 to 262144
View Java execution failure related to authentication
- Jump to Unix Services command shell prompt =u
- javac db2jdbc4.java
- java db2jdbc4
Carefully reading the failure diagnostics written to the display indicates connection authorization failure.
Modify Java code correcting issue with authentication failure
- oedit db2jdbc4.java
- find and change userid, z#####, and wrong password, wrongpwd, to your valid userid and password
- f3 to save and exit
- javac db2jdbc4.java
- java db2jdbc4
Modify Java code correcting issue with DB2 SQL Error
Carefully read the DB2 SQL error that includes SQLERRMC=value
The value is NOT your table created in the previous challenge
Read the incorrect table value very carefully
The value must be an identical match to the table name you previously created and loaded
From Unix Services shell prompt
- oedit db2jdbc4.java
- find and change the table name to your table from previous challenge
- f3 to save and exit
- javac db2jdbc4.java
- java db2jdbc4
If the output looks good, then exit from the Unix shell prompt and return to ISPF.
Java program execution using JCL
Execute the db2jdbc4 java program using JCL which writes output to Z#####.P3.OUTPUT(#08)
tso submit 'zos.public.jcl(db2jdbc4)'
Feel free to check the JCL job for successful completion and the Z#####.P3.OUTPUT(#08) for the output previously displayed when java program was executed from Unix shell prompt.