Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 9 additions & 20 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,18 @@ on:

jobs:
check-copyright:
name: Check Copyright
runs-on: ubuntu-latest
name: Check Copyright
steps:
- uses: actions/checkout@v3

- name: Check Copyright
env:
EXTENSIONS: "*.java"
COPYRIGHT_STATEMENT: "/**\n * Copyright IBM Corp. 2025\n */"
run: |
for ext in $EXTENSIONS; do
for file in $(find . -type f -name "$ext" ! -path "cics-java-osgi-jdbc-app/*"); do
if ! grep -q "Copyright" "$file"; then
echo -e "$COPYRIGHT_STATEMENT\n$(cat "$file")" > "$file"
fi
done
done

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
- uses: actions/checkout@v4
- id: copyright-action
uses: cicsdev/.github/.github/actions/samples-copyright-checker@139edd8dc23af7f4f7dd9afe4d56a1053fe426a7
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: ${{ github.head_ref }}
directory: './cics-java-osgi-jdbc-app/'
file-extensions: '*.java'
base-copyright: 'Copyright IBM Corp. 2025'
token: ${{ secrets.GITHUB_TOKEN }}


build-mvnw:
name: Build Maven Wrapper
Expand Down
112 changes: 90 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ This sample demonstrates an OSGi JDBC application integrated with IBM CICS that
The application makes use of the employee sample table supplied with Db2 for z/OS. The application allows you to display employee information from the table EMP. The sample also provides a set of Gradle and Maven build files for use either in Eclipse or standalone build environments.

## Requirements
* CICS TS V5.5 or later
* A connected CICS DB2CONN resource. For more information, see [Deploying](#deploying)
* CICS TS V6.1 or later
* A connected CICS DB2CONN resource. For more information, see [DB2CONN](#cics-db2conn-connection)
* An OSGi JVM server
* Java SE 1.8 or later on the workstation
* IBM Db2 V11 or later on z/OS
Expand Down Expand Up @@ -70,10 +70,62 @@ mvn clean verify
mvn clean verify -Dcics.jvmserver=MYJVM
```

## Deploying
Configure the JVM profile of the OSGi JVM server to include the Db2 driver JARs in the `OSGI_BUNDLES` environment variable and the Db2 library in the `LIBRARY_SUFFIX` environment variable. For more information, see the provided [JVM profile template](etc/jvmprofiles/DFHOSGI.jvmprofile). If necessary, restart the JVM server.
## Deploying to CICS
### Configure CICS JCL
To allow your CICS region to connect to DB2, we need to add some configuration to the JCL.

Ensure a CICS DB2CONN is installed and connected.
```
// SET DB2=V12 - DB2 Version
...
<variables>
...
DB2CONN=YES

//STEPLIB
...
// DD DISP=SHR,DSN=SYS2.DB2.&DB2..SDSNLOAD
// DD DISP=SHR,DSN=SYS2.DB2.&DB2..SDSNLOD2
// DD DISP=SHR,DSN=DSN&DB2.P2.RUNLIB.LOAD
```

### Configure the JVM Profile
Configure the JVM profile of the OSGi JVM server to include the Db2 driver JARs in the `OSGI_BUNDLES` environment variable and the Db2 library in the `LIBRARY_SUFFIX` environment variable.

> Note: The same of your JVM profile MUST be DFHOSGI

```
DB2_PATH=/usr/lpp/db2v12
OSGI_BUNDLES=&DB2_PATH;/jdbc/classes/db2jcc4.jar,\
&DB2_PATH;/jdbc/classes/db2jcc_license_cisuz.jar
LIBPATH_SUFFIX=&DB2_PATH;/jdbc/lib
```
>Note: This example is using db2v12, this version must be consistent to the version set in your JCL.

As an example, see the provided [JVM profile template](etc/jvmprofiles/DFHOSGI.jvmprofile). If necessary, restart the JVM server.

---

### CICS DB2CONN Connection

Ensure a CICS DB2CONN is installed and connected.

```
CEDA DEFINE DB2CONN(JODBCONN) GROUP(CDEVJODB)
```
```
CEDA INSTALL DB2CONN(CDEVJODB) GROUP(CDEVJODB)
```

### CICS DB2CONN Connection with CICS Explorer
1. Definitions > Db2 > Db2 Connection Definitions
2. Right-click > New...
3. Fill in the Name and Group with `CDEVJODB`
4. Right-click and install the new definition
5. Ensure it is CONNECTED

> Note: The DB2ID differs between DB2 versions and the system you are running your CICS region on. For example, DB2V12 on plex2c, the DB2ID would be DK2C.

---

### Deploying using command line tools
1. Upload the built CICS bundle ZIP file from your *projects/cics-java-osgi-jdbc-bundle/target* or *projects/cics-java-osgi-jdbc-bundle/build/distributions* directory to z/FS on the host system (e.g. FTP).
Expand All @@ -91,35 +143,51 @@ Ensure a CICS DB2CONN is installed and connected.
2. Create a new OSGi bundlepart that references the JAR file.
3. Deploy the CICS bundle project from CICS Explorer using the **Export Bundle Project to z/OS UNIX File System** wizard.

### Deploying using CICS Explorer and CICS Bundle ZIP
1. Connect to USS on the host system (e.g. SSH).
2. Create the bundle directory for the project.
3. Copy & paste the built CICS bundle ZIP file from your *projects/cics-java-osgi-jdbc-bundle/target* or *projects/cics-java-osgi-jdbc-bundle/build/distributions* directory to z/FS on the host system into the bundle directory.
4. Extract ther ZIP by right-clicking on the ZIP file > User Action > unjar...
5. Refresh the bundle directory

---

### Installing the bundle
1. Create a new bundle definition, setting the bundle directory to the deployed bundle directory:
```
BUNDLE(CDEVJODB) GROUP(CICSDEV) BUNDLEDIR(/path/to/bundle/directory)
BUNDLE(CDEVJODB) GROUP(CDEVJODB) BUNDLEDIR(/path/to/bundle/directory)
```
2. Install the bundle

### Installing the bundle with CICS Explorer
1. Definitions > Bundle Definitions
2. Right-click > New...
3. Fill in the Bundle and Group names as `CDEVJODB`
4. Fill in the Bundle Directory to point to the directory you expanded the ZIP
5. Install the bundle

## Running
To run the sample, run the transaction `JODB`.

The terminal should contain contents similar to the following:

```
JODB
000001 BILBO BAGGINS 2004.00
000010 CHRISTINE HAAS 52750.00
000020 MICHAEL THOMPSON 41250.00
000030 SAL KWAN 38250.00
000050 JOHN GEYER 40175.00
000060 IRVING STERN 32250.00
000070 EVA PULASKI 36170.00
000090 EILEEN HENDERSON 29750.00
000100 THEODORE SPENSER 26150.00
000110 VINCENZO LUCCHESI 46500.00
000120 SEAN O'CONNELL 29250.00
000130 DOLORES QUINTANA 23800.00
000140 HEATHER NICHOLLS 28420.00
000150 BRUCE ADAMSON 25280.00
000160 ELIZABETH PIANKA 22250.00
JODB
000001 BILBO BAGGINS 2004.00
000010 CHRISTINE HAAS 90.00
000020 MICHAEL THOMPSON 41250.00
000030 SAL KWAN 38250.00
000050 JOHN GEYER 40175.00
000060 IRVING STERN 32250.00
000070 EVA PULASKI 36170.00
000090 EILEEN HENDERSON 29750.00
000100 THEODORE SPENSER 26150.00
000110 VINCENZO LUCCHESI 46500.00
000111 TES TEST 1000000.00
000120 SEAN O'CONNELL 29250.00
000130 DOLORES QUINTANA 23800.00
000140 HEATHER NICHOLLS 28420.00
000150 BRUCE ADAMSON 25280.00
```

The actual contents will be based on the values in the `EMP` table in the database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ Bundle-Name: CICS OSGi JDBC application - Application
Bundle-SymbolicName: com.ibm.cicsdev.java.osgi.jdbc
Bundle-Version: 1.0.0
Import-Package: com.ibm.cicsdev.java.osgi.jdbc;version="1.0.0",
com.ibm.cics.server;version="[2.0.0,3.0.0)"
com.ibm.cics.server;version="[2.0.0,3.0.0)",com.ibm.db2.jcc
Export-Package: com.ibm.cicsdev.java.osgi.jdbc;version="1.0.0"
CICS-MainClass: com.ibm.cicsdev.java.osgi.jdbc.JDBCQueryProgram
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<cicsdefinitiontransaction name="JODB" program="CDEVCPCL"
<cicsdefinitiontransaction name="JODB" program="CDEVJODB"
description="Runs OSGi JDBC program." />
2 changes: 1 addition & 1 deletion etc/jvmprofiles/DFHOSGI.jvmprofile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ WORK_DIR=.
_BPXK_DISABLE_SHLIB=YES

# Db2 paths
DB2_PATH=/usr/lpp/db2v13
DB2_PATH=/usr/lpp/db2v12
OSGI_BUNDLES=&DB2_PATH;/jdbc/classes/db2jcc4.jar,\
&DB2_PATH;/jdbc/classes/db2jcc_license_cisuz.jar
LIBPATH_SUFFIX=&DB2_PATH;/jdbc/lib