Rob Heittman wrote:
> Hi all,
> 
> It seems to me that the 1.4 behavior of BasicDataSource with regard to
> setDriverClassLoader(...) is slightly off.  In my case -- using this to
> enable DBCP to work better under some OSGi environments -- it doesn't have
> the desired effect.  In createConnectionFactory() we have, essentially
> 
>             if (driverFromCCL == null) {
>                 // use DriverManager, which doesn't respect
> driverClassLoader
>                 driver = DriverManager.getDriver(url);
>             } else {
>                 // ... use the CCL to make our own Driver ...
>             }
> 
> It's simple enough in my project to override createConnectionFactory(), but
> wouldn't it be more predictable to do something like this?
> 
>             if (driverClassLoader !=null) {
>                 // ... use driverClassLoader to make our own Driver ...
>             } else if (driverFromCCL == null) {
>                 // use a method that doesn't respect driverClassLoader
>                 driver = DriverManager.getDriver(url);
>             } else {
>                 // ... use the CCL to make our own Driver ...
>             }
> 
> Alternatively, a couple stanzas higher, we could set driverFromCCL if
> driverClassLoader is used, which would trigger the correct behavior in this
> (unmodified) section.
> 
> It seems like if somebody goes to the trouble to setDriverClassLoader(...)
> they expect it to be used to load driver classes.  (I did)  If wiser heads
> agree, happy to send a patch.

Thanks!  You can attach a patch to
https://issues.apache.org/jira/browse/DBCP-333

Phil
> 
> - Rob
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to