天天看点

7-22

错误记录

  1. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'code' at line 1

    原因: 'code'应使用反单引号``

    建议:在java中使用SQL语句时可在MYSQL客户端工具中先编写一遍查看有无语法错误.

  2. Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'password' at row 1 问题语句:password= Md5Utils.md5BouncyCastle(password + code);

    原因:password数据过长. 表中需求为30位, 生成的MD5码为32位.解决方案:语句后加入substring(0,30)

    password= Md5Utils.md5BouncyCastle(password + code).substring(0,30); //生成30位的MD5密码

    建议:需要更为妥善的解决办法################7-26 更新: 将数据表中的password改为32位
  1. 注意code与password的排位顺序,顺序不同生成的MD5码也不同