Bug #19169 ConnectionProperties lost during serialization
Submitted: 18 Apr 2006 16:56 Modified: 26 Jul 2006 18:17
Reporter: Tero Katajainen Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.1.10 OS:Java
Assigned to: CPU Architecture:Any

[18 Apr 2006 16:56] Tero Katajainen
Description:
 MySqlDatasource has been marked as Serializable, f.ex. Orion application server does serialize it to the JNDI tree. It also extends ConnectionProperties, but this class is not marked as Serializable. 

 This lead to the properties defined in the data source configuration to be lost after serialization, f.ex. zeroDateTimeBehavior would be set back to exception, even if it was configured to convertToNull . Marking ConnectionProperties and its inner classes as Serializable fixed the problem.

 This bug would break the 0000-00-00 00:00:00 timestamp to null conversion and consequently break any applications relying on that behavior. Furthermore, Orion only serializes the datasource when it re-deploys J2EE applications, so this bug would not manifest itself, if the application server would be shut down after each redeployment.

How to repeat:
 Create a MysqlDataSource and set the property zeroDateTimeBehavior to convertToNull. Serialize the data source and read back. The zeroDateTimeBehavior has been set back to exception.

Suggested fix:
 Mark ConnectionProperties and it's subclasses as Serializable.
[16 Jun 2006 17:55] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/7778
[16 Jun 2006 20:58] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/7783