Commons Dbcp
  1. Commons Dbcp
  2. DBCP-203

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

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.3
    • Labels:
      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);

        Issue Links

          Activity

          Hide
          Phil Steitz added a comment -

          Seems like a reasonable enhancement to be included in 1.3.

          Show
          Phil Steitz added a comment - Seems like a reasonable enhancement to be included in 1.3.
          Hide
          Mark Thomas added a comment -

          This has been fixed in trunk and will be included in 1.3 onwards.

          Show
          Mark Thomas added a comment - This has been fixed in trunk and will be included in 1.3 onwards.
          Hide
          Phil Steitz added a comment -

          IIUC what is going on, DBCP-333 is pointing to a bug in the implementation of this feature.

          Show
          Phil Steitz added a comment - IIUC what is going on, DBCP-333 is pointing to a bug in the implementation of this feature.
          Hide
          Mark Thomas added a comment -

          DBCP-333 is now fixed.

          Show
          Mark Thomas added a comment - DBCP-333 is now fixed.

            People

            • Assignee:
              Mark Thomas
              Reporter:
              Mark Grand
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development