We recently replaced the MySQL JDBC connector with MariaDB connector in our project.
We have a table with latin1 encoding but sometimes we have to insert values that contain japanese characters, for this we used PreparedStatement.setBytes which worked fine until we did the switch.
A workaround for this is to use setBinaryStream instead of setBytes.
The cause might lie in how ParameterWriter writes a byte vs an InputStream: when writing an array it prepends the data with _binary' while it only writes a single quote for streams.
By looking at the network traffic I found that the MySQL connector sends the data converted to hexadecimal and prepended with an x when using setBytes and sends the raw bytes prepended with _binary for setBinaryStream, while the MariaDB connector does the same for setBytes and sends just the raw bytes for setBinaryStream.