<< 使用DOM4J和JDOM分别创建和解析XML | 首页 | ORA-12500, TNS:listener failed to start a dedicated server process >>

java.sql.BatchUpdateException: Overflow Exception trying to bind NaN

JDBC操作偶尔碰到这样的异常: java.sql.BatchUpdateException: Overflow Exception trying to bind NaN
在Sun的Java论坛上有人解释,当把一个非法的数字(如“0f/0f”)绑定到一个字段,执行Update操作就会报这样的错误,如下:

It looks like you did some bad arithmetic, resulting in a "Not A Number" (NaN) result. For example:

public class Nan {     public static void main(String[] args) {        float nan = 0f / 0f;        System.out.println(nan);     }  } 


When you then try to store that value in a floating point column, the database complains. So the problem is in your Java logic, and the database is trying to prevent you from corrupting the column!

It's not specific to the BatchUpdate, it just happened to occur in one, and so the BatchUpdate had to report the error.

标签 : ,



发表评论 发送引用通报