Hi,
I'm considering using DriverAdapterCPDS (with SharedPoolDataSource, but that's beside the point) in a Connection Manager library. But under OSGi environment, DriverAdapterCPDS cannot see the driver class. I would get "no suitable driver found for connection string: ..." I specifically do not want my library to be hard-coupled with any DB driver, so the driver basically should be found from the ContextClassLoader. I noticed that BasicDataSource already has this classloading fanciness as to not solely rely on DriverManager.getDriver, which does not respect ContextClassLoader. I'm wondering if DriverAdapterCPDS should get the same treatment as well? Or any other suggestions?
Right now, I'm using a hack of sub-classing DriverAdapterCPDS and overriding getPooledConnection(...) to catch the exception from super.getPooledConnection(...) and basically try again with the ContextClassLoader. This hack is also ugly because this requires me to add the commons-dbcp jar to my OSGi Bundle-ClassPath, instead of using OSGi Import-Package to consume the commons-dbcp bundle. That's because my overriding uses package private classes (e.g. PooledConenctionImpl), so the new subclass has to be in the same package, thus introducing a split package, and a bunch of other implication / complications. Bundle-ClassPath becomes necessary to sidestep those new problems.
Thanks!
--Ron