Hi,
According to JDBC Specification Java String object could be converted to
backend's Integer type by setObject().
But in PostgreSQL JDBC, it's not true. It seems to be a bug.
Sample:
PreparedStatement stmt = con.prepareStatement("select 1::int = ?");
stmt.setObject(1, "2");
ResultSet rs = stmt.executeQuery();//raises an error here!
*)but the following is OK
stmt.setObject(1, "2",Types.INTEGER);
stmt.setObject(1, "2",Types.OTHER);
Internally stmt.setObject(1, "2") binds "2" as varchar ,
if it binds "2" as unspecified type,the result will be OK.
Regards,
Chen Huajun