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=25762>.
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=25762

SharedPoolDataSource getConnection() throws ClassCastException

           Summary: SharedPoolDataSource getConnection() throws
                    ClassCastException
           Product: Commons
           Version: 1.1 Final
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Dbcp
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Hi there,
I am trying to develop a database webapplication using tomcat 5.0.16 with mysql 
3.23.54 on redhat 9 linux.

BasicDataSource works just fine until I try to swith the user credintials, i.e. 
getConnection(String username, String password) does not work. It throws 
UnsupportedOperation exception by definition.

That is when I browsed the commons-dbcp looking for something else to find 
SharedPoolDataSource that, as far as I understood, works on top of other pool 
like BasicDataSource. When I tried to implement this, I got the following 
exception when trying to call getConnection():
java.lang.ClassCastException
        org.apache.commons.dbcp.datasources.InstanceKeyDataSource.testCPDS
(InstanceKeyDataSource.java:738)
        org.apache.commons.dbcp.datasources.SharedPoolDataSource.registerPool
(SharedPoolDataSource.java:236)
        org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPooledConnec
tionAndInfo(SharedPoolDataSource.java:205)
        org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection
(InstanceKeyDataSource.java:676)
        org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection
(InstanceKeyDataSource

which is, obviously, internal to commons-dbcp. The JNDI lookup works just fine. 
It is only the getConnection().

I am using a BasicDataSourceFactory to generate DataSource objects which I use, 
in turn, as dataSourcName parameter to the SharedPoolDataSourceFactory 
generating SharedPoolDataSource objects. I look up only the 
SharedPoolDataSource object and call its getConnection() method and there you 
go. ClassCastException!

PS. If there is another way of being able to swith connection credintials it 
would be helpful, too.

Thanks,
Ahmad

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

Reply via email to