MySQLIntegrityConstraintViolationException: Column 'username' cannot be null 解决方法
根据错误信息,出现了 MySQLIntegrityConstraintViolationException 异常,异常信息是 "Column 'username' cannot be null",意思是插入数据时 username 列不能为空。\n\n根据异常堆栈信息可以看到,异常出现在 books.liao.dao.AdminDao.updateAdmin 方法的第 27 行,以及 books.liao.servlet.UpdateAminServlet 的第 36 行。\n\n可能的原因是在执行数据库更新操作时,使用的 SQL 语句中没有给 username 列赋值或者赋值为 null。需要检查代码中的 SQL 语句和参数赋值,确保 username 列有被正确地赋值。
原文地址: https://www.cveoy.top/t/topic/pZJa 著作权归作者所有。请勿转载和采集!