0

Title says it all. This is my workaround and unfortunately no luck from my end on this. Having these 2 jar files from db2:

  1. db2jcc.jar
  2. db2jcc_license_cu.jar

Tried putting them in Websphere variables by locating there path, added them in the Classpath textarea during the creation of JDBC(both using the websphere variable and its absolute path from those jar files) but still, WAS not picking these jar files whenever I check them in Troubleshooting > Class loader view.

I manually added them in the AppServer/lib/ext and WAS can pick them up but, I dont want to do this because this solution exposes to other profiles. I want to utilize the Websphere variable function here in WAS.

Any help is very much appreciated.

Fealrone Alajas
  • 159
  • 1
  • 2
  • 12

1 Answers1

0

You actually need to create a DB2 JDBC Provider and Datasource and then use the JNDI name of the Datasource from your app to get the JDBC Connection.

During the JDBC Provider creation you declare the location of the jars you mention.

trikelef
  • 2,192
  • 1
  • 22
  • 39
  • hi. i already did that (as stated in my post) but still was not picking those jar files. i even followed this tutorial in youtube: https://www.youtube.com/watch?v=raLYlwOIbnE but lady luck aint leaning on my side. p.s. credits to the owner of that vid tutorial – Fealrone Alajas Oct 11 '17 at 17:42
  • 1
    Actually your post didn't state that you did what trikelef said needed to be done. You simply said "during the creation of JDBC". That's not a thing in WAS. In WAS, you create a "JDBC Provider" and then a "Datasource" that references the JDBC Provider. If you created a JDBC Provider using the admin console wizard and selected a provider type of "DB2 Using IBM JCC Driver", the classpath to the db2 jdbc driver jars are preset for you using standard WAS variables. Did you create the datasource? How are you accessing it in your app? Or are you accessing the JDBC DriverManager directly? – F Rowe Oct 11 '17 at 18:15
  • @FRowe sorry. yes,did create jdbc provider as well as the datasource. pointed my datasource to my jdbc provider. as for the accessing, my springboot app tries to access the jndi c/o JndiObjectFactoryBean. – Fealrone Alajas Oct 12 '17 at 04:00
  • 1
    Can you test the connection on the Datasource? If this fails with something like classnotfound, check the Websphere Variables like DB2UNIVERSAL_JDBC_DRIVER_PATH or DB2_JCC_DRIVER_PATH at the scope (i.e. cell/node/server) of the datasource to see what they contain. – trikelef Oct 12 '17 at 08:26
  • @trikelef connection is ok. no error. i already consulted this to my onshore and no matter what we do, was cannot pick up the db2jars. – Fealrone Alajas Oct 13 '17 at 07:10
  • If test connection is working then the jars are accessible by the datasource in WAS and a java ee app can easily obtain the datasource either by injection or lookup. The problem appears to be spring, perhaps you're having the problem discussed here: https://stackoverflow.com/questions/36575383/why-use-jndiobjectfactorybean-to-config-jndi-datasource-did-not-work – F Rowe Oct 13 '17 at 12:57