You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mark Thomas (JIRA)" <ji...@apache.org> on 2011/03/22 21:48:05 UTC

[jira] [Resolved] (DBCP-203) Want to provide a ClassLoader for BasicDataSource to use for loading a JDBC driver.

     [ https://issues.apache.org/jira/browse/DBCP-203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Thomas resolved DBCP-203.
------------------------------

    Resolution: Fixed

DBCP-333 is now fixed.

> Want to provide a ClassLoader for BasicDataSource to use for loading a JDBC driver.
> -----------------------------------------------------------------------------------
>
>                 Key: DBCP-203
>                 URL: https://issues.apache.org/jira/browse/DBCP-203
>             Project: Commons Dbcp
>          Issue Type: New Feature
>    Affects Versions: 1.2.1
>            Reporter: Mark Grand
>            Assignee: Mark Thomas
>            Priority: Minor
>             Fix For: 1.3
>
>
> I have an application that will be configured to use a JDBC driver at run time.  It would be helpful if I could set the ClassLoader that BasicDataSource uses to load the JDBC driver.  
> I don't know what the procedure is for submitting improvements, but this is something that I could add myself. the code would look like this:
> private ClassLoader driverLoader = getClass().getClassLoader();
> ...
> public ClassLoader getDriverLoader() {
>     return driverLoader();
> }
> public void setDriverLoader(ClassLoader newValue) {
>     driverLoader = newValue;
> }
> ...
> Change the statement that in createDataSource from
>     Class.forName(driverClassName);
> to be
>     Class.forName(driverClassName, true, driverLoader);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira