解决:Out of range value adjusted for column 'catalogid' at row 1

2012-05-07 15:31:05,843 [ERROR] (BasketManager.java:1368) ::  exception occurred in adding user, sqlEx: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value adjusted for column 'catalogid' at row 1; erroCode: 1264
2012-05-07 15:31:05,859 [FATAL] (BasketManager.java:1377) ::  directory db add user exception
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value adjusted for column 'catalogid' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3564)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2409)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2327)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2312)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
at com.messagesolution.webapp.action.basket.BasketManager.insertCatalogDetail(BasketManager.java:1365)

  解决方法(1):(个人测试的结果)
数据库中的id设置为int类型,而在java bean中id的类型为String类型。(java bean中id应与mysql中的id类型保持一致)...
(本人由于粗心大意,把相应的参数传错了。。特记下此错误)
  解决方法(2):(在网上查找的)
提示:Out of range value adjusted for column 'id' at row 1的解决方法
作者:bjbs_270 来源:csdn.net
    MySQL升级到5.0.17后,在执行sql语句INSERT INTO `news` (`ID`, `Title`, `Content`) VALUES (’’, ’标题’, ’正文’);时出现错误:#1264 - Out of range value adjusted for column ’ID’ at row 1.
 
解决方法:修改my.ini,将:
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"改为。sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION";。


-*后记*-今天遇到Out of range value adjusted for column 'id' at row 1一样的的提示,头痛了好一阵,百度了一下,终于找到了这跟稻草,呵呵,拿出来,如果大家有人遇到同样的问题,用这个方法应该就能解决的.

你可能感兴趣的:(java,mysql,jdbc)