Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-203

Want to provide a ClassLoader for BasicDataSource to use for loading a JDBC driver.

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.2.1
    • 1.3
    • None

    Description

      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);

      Attachments

        Issue Links

          Activity

            People

              markt Mark Thomas
              mgrand Mark Grand
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: