Bug #48486 Cannot use loadbalance with MysqlConnectionPoolDataSource
Submitted: 2 Nov 2009 22:25 Modified: 3 Nov 2009 17:42
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.10 OS:Any
Assigned to: Mark Matthews CPU Architecture:Any

[2 Nov 2009 22:25] Todd Farmer
Description:
Using MysqlConnectionPoolDataSource with a loadbalance URL causes ClassCastExceptions:

ClassCastException in MysqlConnectionPoolDataSource
Caused by: java.lang.ClassCastException: $Proxy0
   at com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource.getPooledConnection(MysqlConnectionPoolDataSource.java:80)

and

java.lang.ClassCastException: $Proxy2
 at com.mysql.jdbc.jdbc2.optional.StatementWrapper.executeQuery(StatementWrapper.java:744)

How to repeat:
Try using MysqlConnectionPoolDataSource.getPooledConnection() with a loadbalanced connection URL.

Suggested fix:
Eliminate exceptions
[2 Nov 2009 22:34] Mark Matthews
Fixed for 5.1.11.
[3 Nov 2009 17:42] Tony Bedford
An entry was added to the 5.1.11 changelog:

Using MysqlConnectionPoolDataSource with a load-balanced URL generated exceptions of type ClassCastException:

ClassCastException in MysqlConnectionPoolDataSource
Caused by: java.lang.ClassCastException: $Proxy0
   at
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource.getPooledConnection(MysqlConne
ctionPoolDataSource.java:80)

java.lang.ClassCastException: $Proxy2
 at com.mysql.jdbc.jdbc2.optional.StatementWrapper.executeQuery(StatementWrapper.java:744)