在项目中将数据插入MySQL时,会出现错误信息,请查阅网上相关文章后再解决,并记录下来,作为下次参考。
错误消息1:mysqlintegrityconstraintviolationexception # # # errorupdatingdatabase.cause : com.MySQL.JDBC.exceptions.JDBC4. mysqlintegrityconstraintviolationexception 3360 unk kkkk Dao.register mapper.add register-inline # # theerroroccurredwhilesettingparametering
错误原因
将字段设置为null,然后插入该字段并插入非null判断错误提示2:mysqldatatruncationcause : com.MySQL.JDBC.MySQL data truncation
解决方法:适当增加数据库字段的长度
错误原因
附: mysql错误代码大全