On 19/12/2007, Guillaume Nodet <[EMAIL PROTECTED]> wrote: > > This won't answer the question, but what about registering a DataSource in > the OSGi registry and use it instead ? > That way, you could easily create a bundle that will import the needed > package from your JDBC driver, create the DataSource and register it in > OSGi...
yes, using DataSource is much nicer, unfortunately a lot of legacy code uses DriverManager... I guess your problem comes from the fact that the DriverManager is provided > by the System bundle, so I doubt you could even use the dynamic import > package thingy. But I guess the problem is the same for XML parsers and > all, so there must be a solution to that. the origin of DriverManager shouldn't matter, as its own classloader isn't typically involved - it's the calling classloader that's the key, hence the need for imports to get a consistent class space... it's amazing how many approaches there are for getting classes in a given context, even in the core J2SE classes - it's only when you start using a modular system like OSGi that you realize how fragile this code is (it often seems to work by accident rather than design!) On Dec 19, 2007 10:58 AM, Damian Gołda <[EMAIL PROTECTED]> wrote: > > > I have question, not regarding OPS4J but you are OSGi experts ... > > > > In many libraries, especially providing database connection pools, > > there is used DriverManager for instantiation of JDBC Driver. > > I can't force DriverManager to work in OSGi - it always cannot find > > class with driver. I've looked in its source code and find weird way > > to find "correct" classloader, which actually is unuseful, because > > doesn't use bundle classloader or context classloader. > > > > Do you have any solutions, how to solve that problem? > > Only solution working for me is to modify source code of connection > > pool, to not use DriverManager. But I hate it... > > I try to use C3P0. > > -- > > Damian > > > > _______________________________________________ > > general mailing list > > [email protected] > > http://lists.ops4j.org/mailman/listinfo/general > > > > > > -- > Cheers, > Guillaume Nodet > ------------------------ > Blog: http://gnodet.blogspot.com/ > _______________________________________________ > general mailing list > [email protected] > http://lists.ops4j.org/mailman/listinfo/general > > -- Cheers, Stuart
_______________________________________________ general mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/general
