Bug #101242 | Cannot use ByteArrayInputStream as arguments in prepared statements anymore | ||
---|---|---|---|
Submitted: | 20 Oct 2020 11:56 | Modified: | 12 Jan 2021 21:55 |
Reporter: | Martynas Puronas | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S3 (Non-critical) |
Version: | 8.0.22 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | regression |
[20 Oct 2020 11:56]
Martynas Puronas
[20 Oct 2020 12:06]
MySQL Verification Team
Hello Martynas, Thank you for the report and feedback. regards, Umesh
[27 Nov 2020 21:34]
Greg Brown
I just ran into this myself with a FileInputStream. My code works with 8.0.15 but fails in 8.0.22 because of this issue. The ticket is currently ranked as "non-critical"; however, I would consider it a higher priority since it will prevent anyone who uses BLOBs from upgrading to 8.0.22+.
[27 Nov 2020 21:39]
Greg Brown
Specifically, the code fails on (what is currently) line 230: MysqlType defaultMysqlType = DEFAULT_MYSQL_TYPES.get(parameterObj.getClass()); The previous version used instanceof instead of getClass(). As currently written, this code will always fail - since InputStream is abstract, the value returned by getClass() for parameterObj can never actually be InputStream and will never produce a valid lookup from the type map.
[12 Jan 2021 21:55]
Daniel So
Posted by developer: Added the following entry to the Connector/J 8.0.23 changelog: "Using the setObject() method to set a ByteArrayInputStream instance for a PreparedStatement resulted in a SQLException. "