I am having this question that really puzzles me, here it goes:
If I connect to DB2 on linux via java app, I don’t need to add any db2 jar file to CP, as long as java.library.path has the right native library path included, the connection looks fine;
If I connect to Oracle, I kindof have to add the ojdbcX jar file to CP and have the right library path in java.library.path as well to ensure the successful connection.
Am I not seeing the full picture or this is how they work? Any pointers?
I have 2 explanations and hope that one of them is correct.
Probably DB2 driver is fully native, i.e. there is not java code at all. So, you do not have to add any jar to classpath. Other possibility is that probably the native code of DB2 connector (driver) loads java classes itself.
Other explanation is that you probably installed some kind of DB2 kit or client on your system and the installation program changed environment variable CLASSPATH and added there db2 jar, so this jar is available for all java applications on your machine.