Question
Last activity: 28 Sep 2015 10:43 EDT
Loading DB2 JDBC (db2jcc.jar) driver on startup of WebSphere Application Server
I am currently using Pega 7.1.9 on WebSphere Application Server v 8.5.5 and DB2 10.5 LUW which is installed in a PC server ( Proprietary information hidden).
I created a database rule which uses JDBC definition and it's URL points to external DB2 database ( Proprietary information hidden2).
Whenever I click on "Test connection" button, I get an error "Status Value: Problem encountered when getting a database connection: code: 0 SQLState: 08001 Message: No suitable driver Fail", which seems to be the JDBC driver is not loaded.
To get this to work, I need to go to
System Management Application -> select node -> Advanced -> ETier Runtime Environment, and for a "Java Class Name:" text box, type "com.ibm.db2.jcc.DB2Driver" and click "Lookup Java Class" to search for the JDBC driver for DB2.
After doing this step and go back to "Test Connection", I will be able to connect to the database.
I do not want to go to SMA and lookup for the driver to load the JDBC driver. Is there a correct way to load the JDBC driver at the startup of WebSphere Application Server??
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Hi Richard,
Thank you for very helpful answer
I didn't edit the prconfig.xml as you mentioned above, however I created new Dynamic System Setting as follows.
Owning Ruleset: Pega-Engine
Setting Purpose: prconfig/database/drivers/default
Value: com.ibm.db2.jcc.DB2Driver
Then I restarted the WebSphere.
As a result, the test connection was successful.
Pegasystems Inc.
JP
Hi Toshi,
Welcome to mesh!
Check Dynamic system setting: compiler/defaultClasses
see if the JDBC driver class is listed there.
CZ
Hi Chunzhi,
Thanks! I will try this later on after the users are done with their work, so I can restart the server.
I also found a similar topic in PDN (Unable to locate the external jar- Connect MQ throws exception). Seems like one of the resolution is to
- set the compile time class path, which is the way you mentioned to set the compiler/defaultClasses.
The other is to
- set the runtime class path, as for WebSphere, create a Shared Library and put the .jar file there
I have tried the second method on WebSphere, but maybe my setting was wrong. I will try both ways later on and would like to post the results for these methods later on.
Compile Time Class Path method
I set the Dynamic system settings: compiler/defaultClasses to "com.ibm.db2.jcc.DB2Driver" and restarted the WAS, but the situation doesn't change...
Runtime Class Path method
I also set the Shared Library in WAS like below:
Name: db2jcc library
Description: JDBC driver for db2
Classpath: ${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc4.jar
${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cu.jar
Native Library Path: (blank)
Unfortunately, neither of these worked and I am still getting the same error.
Seems like PRPC is not loading com.ibm.db2.jcc.DB2Driver class on the start up. When use SMA's Java Class Lookup, PRPC loads the class and I am able to use the driver.
Pegasystems Inc.
JP
SMA can load the class means the classpath is not a problem.
Perhapse dynamic system setting's key name is not recognized as prconfig setting. try this "prconfig/compiler/defaultClasses/default", instead of "compiler/defaultClasses".
Pegasystems Inc.
JP
you need to restart the WAS.
I added dynamic system setting: "prconfig/compiler/defaultclasses/default" with value "com.ibm.db2.jcc.DB2Driver" and restarted the WAS, but the situation is not resolved. The same error showed up....
SMA can load the class means the classpath is not a problem.
Yes, totally I agree with you. PRPC recognizes the classpath, however it seems like it is not loading the "com.ibm.db2.jcc.DB2Driver" class at the startup.
Pegasystems Inc.
JP
Maybe it is because that Data-Admin-DB-Name rule is a data class and it doesn't need a rule assembly, so even the JDBC driver class is listed in the compiler/defaultClasses setting, it doesn't load.
If you still need to configure in this approach, (other than using a datasource defined in AP Server)
you can try writing an activity rule, that contains a java step in which the jdbc driver class is referred (jdbc programming), then run the activity to test if you can connect to the database.
Pegasystems Inc.
JP
By the way, Have you tried below?
1.Create DataSource on your application server, which connect to External DB2.
2.Create Data-Admin-DB-Name in Pega, using JNDI pointing to the above datasource.
I haven't tried this method yet. But, I am pretty sure that if I make a connection this way, it will work without any problem. Wondering which way is better.
Pegasystems Inc.
JP
Managing Data base connection with application server is better approach.
There are many good features available with Websphere to manage/monitor db connections.
This method worked without any problem.
I added a datasource in WAS and changed the setting in the Database rule to below.
Database
How to connect: use JDBC URL listed below --> use JDBC Connection Pool
JDBC DataSource settings
JNDI name: jdbc/Hokenkin (JNDI defined in WAS datasource setting)
Admin JNDI name: (blank)
Authentication
Username: (blank)
Password: (blank)
Admin username: (blank)
Admin password: (blank)
Pegasystems Inc.
US
Are you all set? If that is the case, please make your question answered.
Pegasystems Inc.
US
There are websphere defined resources that are referenced in the DB2 Universal JDBC Driver Provider properties like the following
These intern are defined as Websphere variables like so:
In this way Websphere should take care of loading the driver as needed.
(PegaRULES is defined as a data source using this JDBC provider)
See the configuration and installation guide for further details regarding configuring JDBC Data sources for Pega.
Hi Jim,
Thanks for the setting information. I've set the DB2UNIVERSAL_JDBC_DRIVER_PATH and DB2UNIVERSAL_JDBC_DRIVER_NATIVEPATH to "C:\Program Files\IBM\SQLLIB\java" on the WAS, restarted the WAS, but the situation doesn't change.....
Pegasystems Inc.
US
Hi Toshihide,
Please open an SR and we can investigate.
We should be able to get this up and going for you.
Virtusa
US
Hello Toshihide,
I am facing same issue in Pega 7.1.7. we have upgraded our app from 6.1sp2 to 7.1.7.
Please let me know if you got any fix from Pega.
Thanks,
Khareem
Pegasystems Inc.
US
I have posted this in another internal link. Reposting it here: have you tried to put the jar under the endorsed directory which by default is: /opt/IBM/WebSphere/AppServer/endorsed_apis:/opt/IBM/WebSphere/AppServer/java_1.7_64/jre/lib/endorsed:/opt/IBM/WebSphere/AppServer/java/jre/lib/endorsed
Hi Toshihide,
I have run into this problem as well when speciying a JDBC URL within PRPC. You need to specify the driver class in prconfig.xml. On WebSphere find prresources.jar and then extract prconfig.xml:
jar -xf prresources.jar prconfig.xml
Edit prconfig.xml to include the DB2 driver class: ( there's an example for this in prconfig.xml )
<env name="database/drivers" value="com.ibm.db2.jcc.DB2Driver" />
Add prconfig.xml back to prresources.jar
jar -uf prresources.jar prconfig.xml
Now restart WebSphere and retry your connection test.
Accepted Solution
Hi Richard,
Thank you for very helpful answer
I didn't edit the prconfig.xml as you mentioned above, however I created new Dynamic System Setting as follows.
Owning Ruleset: Pega-Engine
Setting Purpose: prconfig/database/drivers/default
Value: com.ibm.db2.jcc.DB2Driver
Then I restarted the WebSphere.
As a result, the test connection was successful.
Thanks for the update Toshihide. Using a dynamic system setting is more desirable for maintainability reasons.