mybatis项目报java.sql.SQLException: Numeric Overflow的异常
生活随笔
收集整理的這篇文章主要介紹了
mybatis项目报java.sql.SQLException: Numeric Overflow的异常
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
轉載自:http://www.easytd.com/yichangjijin/d_1411081846.html
項目報java.sql.SQLException: Numeric Overflow的異常,數據庫oracle,使用的mybatis異常信息如下:
java.sql.SQLException: Numeric Overflow; uncategorized SQLException for SQL []; SQL state [99999]; error code [17026]; Numeric Overflow; nested exception is java.sql.SQLException: Numeric Overflow從下面了解到信息:
http://www.coderanch.com/t/610303/JDBC/databases/SQL-state-error-code-NumericThis is just a guess, but it looks like you're trying to fetch a value from a ResultSet which doesn't fit into the chosen type in Java. Oracle can store numbers with up to 38 digits (disregarding the scale for now), which far exceeds even the range of Java's long datatype. Inspect the values you're trying to select from Oracle to see whether they don't contain some really large values.也就是說oracle中的數字可能會大過java中long類型的數字,建議使用BigInteger or BigDecimal。
在我當前項目是因為項目中用的是short類型,而數據庫中的數據達到了37000多,于是就溢出了。解決方法更改java中的數據類型就可以了。總結
以上是生活随笔為你收集整理的mybatis项目报java.sql.SQLException: Numeric Overflow的异常的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java.lang.Arithmetic
- 下一篇: 使用IntelliJ IDEA 配置Ma