commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 7728] New: - BasicDataSource cannot use many JDBC drivers
Date Wed, 03 Apr 2002 17:26:32 GMT
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: commons-dev@jakarta.apache.org
        ReportedBy: james@interobjective.com


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:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message