用mysql做一个ip地下址库,把ip地址转换成long型后插到数据库(数据库该字段用的是bigint,文档中说有符号的范围是-9223372036854775808到9223372036854775807,无符号的范围是0到
18446744073709551615。),为什么在发生溢出先前用的是hibernate以为是hibernate有问题,改用jdbc插也不行发生溢出,变成负数了,改用unsiged也不行,呵呵,当然会不行,也只多一位
这是jdbc错误抛出异常:Exception in thread "main" java.sql.BatchUpdateException: Data truncation: Out of range value adjusted for column 'lstartip' at row 1
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1269)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:955)
at Initdata3.main(Initdata3.java:106)
--转自