http://stackoverflow.com/questions/26767947/preparedstatement-setstring-on-int-numeric-columns-in-postgresql-jdbchtml
|
The documentation for java.sql.PreparedStatement has this to say:java
Note: The setter methods (setShort, setString, and so on) for setting IN parameter values must specify types that are compatible with the defined SQL type of the input parameter. For instance, if the IN parameter has SQL type INTEGER, then the method setInt should be used.sql
Whether a particular database or JDBC driver allows you to be sloppy about that is its own affair, but you are not justified in expecting that all drivers will allow such slop, even if certain ones do.數據庫 |
另外能夠參考各數據庫對應jdbc類型。api
http://www.cnblogs.com/yj716716yj/p/5526581.htmloracle