The conversion from UNKNOWN to UNKNOWN is unsupported
This error can occur, if you use jdbcTemplate.update(sql, List<Object[]>, int[])
, but instead you wanted to use jdbcTemplate.
batchUpdate
(sql, List<Object[]>, int[])
.
It compiles, because there is a jdbcTemplate.update(sql, Object...)
method in jdbcTemplate, but it will yield "The conversion from UNKNOWN to UNKNOWN is unsupported.", because it cannot use List<Object[]>
as parameter.
I found it. Clockwork-Muse put me on the path. The char type does not convert to an Object when you set the parameters. The following will work:
try (PreparedStatement st = con.prepareStatement(query)) {
int n = 1;
for (Object o : params) {
if (o instanceof Character) {
o = "" + o;
}
st.setObject(n, o);
n++;
}
st.executeQuery();
}