我找到了。发条缪斯使我走上了道路。设置参数时,char类型不会转换为Object。以下将起作用:
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(); }


