[CONJ-849] con/j should not close connection caused java.io.NotSerializableException as a result of incorrect data bind to a prepared statement parameter Created: 2021-01-19  Updated: 2021-04-19  Resolved: 2021-01-29

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 2.6.2, 2.7.1
Fix Version/s: 2.7.2

Type: Bug Priority: Major
Reporter: Richard Stracke Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

If java.io.NotSerializableException is thrown as a result of incorrect data bind to a prepared statement parameter, JDBC driver closes the connection.
Instead, it should treat java.io.NotSerializableException differently similar to how it is handling MaxAllowedPacketException.

AbstractQueryProtocol

NotSerializableException is a transient exception that can be handled without having to close the connection.



 Comments   
Comment by Diego Dupin [ 2021-01-19 ]

this can only occur when using setObject​(int parameterIndex, Object x) and object type cannot be identified.

Best implementation for this specific case would have to throw an exception immediately, but for compatibility sake with previous version (and at some point compatibility with mysql driver) driver serialize object. Handling NotSerializableException to throw exception without discarding connection seems appropriate.

Be aware that in future 3.x version, serialization won't be handle, throwing an exception immediatly on setObject().

Generated at Thu Feb 08 03:18:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.