mybatis项目报java.sql.SQLException: Numeric Overflow的异常
生活随笔
收集整理的這篇文章主要介紹了
mybatis项目报java.sql.SQLException: Numeric Overflow的异常
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
轉(zhuǎn)載自:http://www.easytd.com/yichangjijin/d_1411081846.html
項(xiàng)目報(bào)java.sql.SQLException: Numeric Overflow的異常,數(shù)據(jù)庫(kù)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.也就是說(shuō)oracle中的數(shù)字可能會(huì)大過(guò)java中l(wèi)ong類型的數(shù)字,建議使用BigInteger or BigDecimal。
在我當(dāng)前項(xiàng)目是因?yàn)轫?xiàng)目中用的是short類型,而數(shù)據(jù)庫(kù)中的數(shù)據(jù)達(dá)到了37000多,于是就溢出了。解決方法更改java中的數(shù)據(jù)類型就可以了。總結(jié)
以上是生活随笔為你收集整理的mybatis项目报java.sql.SQLException: Numeric Overflow的异常的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: java.lang.Arithmetic
- 下一篇: Java JDBC中,MySQL字段类型