Announcing the Global SNUG Board of Directors. Learn more here

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Rahul Shandily3
Kilo Guru

Good Morning Everyone,

I was wondering if we have a step-by-step guide on how to connect to a DB2 Database but could not get much information. I did go through the community and found some questions around the area and no one ever came close to providing proper guidance or a solution. I was bored of the resolution "attach the custom jar file" and you are good to connect. May be everyone knows how to connect further or may be people hardly get this as a requirement.

Even before thinking of writing an article, I also thought of checking the Hi Portal for any KB article which might give the resolution on connecting to a DB2 Database. In-fact I found one KB article which does talk about the error while trying to connect to DB2 Database. The KB article provides a link to a URL which states the resolution as “db2jcc_license_cisuz.jar must be in CLASSPATH. Check db2jcc_license_cisuz.jar in Java Class Path or Extra Class Path in driver properties.”

This resolution did not help me much and I had to dig a little further to connect to the Database. I really felt an article or blog should be available to help anyone struggling to connect to DB2 Databases and getting the error:

ERRORCODE=-4230, SQLSTATE=42968

.

Mainframe Databases or DB2 comes with specific licenses, and these are very important to make connection. Here is a try to create a step-by-step guide to connect to a DB2 Database.

Step 1 – Create a Data source

Step 2 – Enter the details of the Data Source as below screenshot.

find_real_file.png

 Step 3 – Create a Mid Server Jar file.

  1. Name – Give any meaningful name.
  2. Version – version of the Jar file (Optional)
  3. Source – (Optional)
  4. Description – (Optional)
  5. Make sure you include the attachment JAR file which is provided in the IBM Client. Mostly it is called DB2jcc.jar. The one that I received after installing the DB2 Client was "DB2jcc4.jar".
  6. Once you save the record, the jar file will be immediately available in the external library (agent\extlib) folder in your MidServer agent(s).

Step 4 – This is the most important step. Login to your Server where your MidServer is installed and where the IBM Client was installed. Open the License folder. (If you have not activated your installation then please do so. Mostly IT departments pre-activate your license and then provide you the Client). Copy the two files “db2jcc_license_cisuz.jar” and the zOS license file. It will have an extension of lic. Now paste the copied files to the “lib” folder in the MidServer Agent.

Disclaimer – All files in the lib folder get deleted at upgrade. To avoid this, you can create a folder called zOS under “agent” folder and append the below line in the file “wrapper-override.conf”.

‘wrapper.java.classpath.3=zos/*.jar’

This line will ensure that apart from the two Java libraries, your midServer Agent also recognizes this as the third Java library.

 Step 5 – Restart your MidServer and you should not get any errors while connecting.

Note: IBM Client is referred in my article. It is pointing to the ‘IBM Data Server Client version 11.5.5’. 

*As a good practice/advice provided by license management, please request for agent installation everytime when you want to consume the z/os license file or db2jcc_license_cisuz.jar. These are not redistributable and should not copied from one system to another! 

Thank you for reading!

Comments
Sneha Snow
Tera Explorer

I have setup the Data Source using the DB2 credentials and attached the JAR file ("DB2jcc4.jar".) to the Mid Server.

Note: “db2jcc4.jar” file was shared by my network/DB team.

Our network/DB team installed a “IBM i Access for Windows” on the Mid Server. However, I was not able to find “db2jcc_license_cisuz.jar” and the zOS license files. Upon requesting my DB team to provide the location of these two files they have mentioned that “IBM i Access for Windows” does not require license.

 

Could you please help me with what “IBM Data Server Client” should I request my DB team to install in order get these two files.

Madhava Bharad1
Tera Contributor

Hi @Rahul Shandily3 This is very helpful article. I was able to configure JDBC connection to DB2 DB Instance. I didn't use zOS license file, it worked without that. Thank you.

Version history
Last update:
‎06-06-2021 06:46 PM
Updated by: