https://issues.apache.org/bugzilla/show_bug.cgi?id=48773

           Summary: DataSourceWrapper and DriverManager problems
           Product: Taglibs
           Version: nightly
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Standard Taglib
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: jga...@gmail.com


Created an attachment (id=25022)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25022)
Patch for this issue.

In certain situations the DataSourceWrapper is not able to connect to the
database even if a driver class name was explicitly set. The core of the
problem is that the DriverManager uses the caller's classloader (in this case
the classloader of DataSourceWrapper) to find a driver for the given url. In
some cases the classloader of DataSourceWrapper might be totally different and
separate from the context classloader that registered the driver with
DriverManager. In these cases the DriverManager will not "see" the driver
registered earlier because of the different classloaders and the
DataSourceWrapper.getConnection() will fail with "unable to find suitable
driver" type of error message.

One easy work solution for this problem is to actually use the driver object
that was registered in setDriverClassName() to connect to the database. And if
the connection fails then fallback to using the DriverManager API.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to