让人无解而且超没成就感的BUG
- 第一种:`com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 1,037,466 milliseconds ago. The last packet sent successfully to the server was 18,904 milliseconds ago`
- 第二种:java.sql.SQLException: No value specified for parameter 2
- 第三种:执行批量插入、批量更新时导致表锁死了
第一种:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 1,037,466 milliseconds ago. The last packet sent successfully to the server was 18,904 milliseconds ago
使用JDBC操作数据库
问题:
简单解释:超出了连接数据库等待时长。
复杂解释:最后一次操作数据库中间处理时长 > 连接数据库等待时长会报出无法连接。
解决可以参考:http://www.kailing.pub/article/index/arcid/160.html
第二种:java.sql.SQLException: No value specified for parameter 2
问题:
检查jdbc的参数个数和你的值的个数是否一致,错误提示为2的参数没有值。
或者注意你插入的数据的字段类型是否一直。
第三种:执行批量插入、批量更新时导致表锁死了
原因:跑多线程的时候,两条数据同时请求获取到数据库表的唯一标识后去操作库会第一个成功后面的再去操作库会导致锁表
解决:只能避免同时操作一样的数据