DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7728>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7728

BasicDataSource cannot use many JDBC drivers

           Summary: BasicDataSource cannot use many JDBC drivers
           Product: Commons
           Version: Nightly Builds
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Dbcp
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Many JDBC drivers (well, at least 2 that I use regularly) do not have a public 
constructor, and therefore you can't call newInstance() on them (which 
BasicDataSource.createDataSource() tries to do).  Drivers instantiate 
themselves in a static {} block, as they are loaded and registered with driver 
manager -- this is what the JavaDOC for javax.sql.Driver says they should do, 
and every one I've seen does do this... this is why they have private 
constructors.

The EASY solution is to replace this line (in createDataSource()):

  driver = (Driver) driverClass.newInstance();

with this one:

  driver = DriverManager.getDriver(url);

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to