PreparedStatement.setString on int/numeric columns-

2016/10/08 12:47
阅读数 73

http://stackoverflow.com/questions/26767947/preparedstatement-setstring-on-int-numeric-columns-in-postgresql-jdbc

 

The documentation for java.sql.PreparedStatement has this to say:

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.

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类型。

http://www.cnblogs.com/yj716716yj/p/5526581.html

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部