Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
1.1.7, 1.1.8, 1.1.9, 1.2.0
-
None
Description
If setting a CHAR(1) database field, using Java char's or java.lang.Character, setObject fails with:
Caused by: java.sql.SQLException: Could not set parameter in setObject, could not convert: class java.lang.Character to 1
|
at org.mariadb.jdbc.internal.SQLExceptionMapper.getSQLException(SQLExceptionMapper.java:161)
|
So where,
setObject(final int parameterIndex, final Object x, final int targetSqlType)
|
Object x is of type java.lang.Character
and targetSqlType is 1 (java.sql.Types.CHAR)
This can be fixed by adding a check for Character type, in setObject:
else if (x instanceof Character) {
|
setString(parameterIndex, x.toString());
|
}
|
Attachments
Issue Links
- is duplicated by
-
CONJ-820 MySQLPreparedStatement.setObject cannot handle java.lang.Character type
- Closed