java.sql.SQLException: Lock wait timeout exceeded;

来源:互联网 发布:少数民族人脸数据库 编辑:程序博客网 时间:2024/05/19 11:50

java.sql.SQLException: org.springframework.dao.CannotAcquireLockException: PreparedStatementCallback; SQL [update social_hunan_seed_info set batchId=?, status='1',last_update_date = now() where status='0' limit ?]; Lock wait timeout exceeded; try restarting transaction; nested exception is java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

从错误上来看是锁的原因,等待锁超时


SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;#查询当前进行锁等待的


可以看到有两条记录,拿着这个id,


select * from information_schema.innodb_trx;#查询所有被锁的


这是所有的,加上上面的id可查询到一条数据,说明被锁住了


锁住时执行的操作,里面可以看到锁住哪张表了。

暂时还不会通过kill  id进程。。。。

show variables like '%table_lock%';#查询系统的锁等待时间




将   '19-5月 -15 00.00.00.000000000 上午'  转换成标准时间格式:

select to_char(cast (cast (createdate  as timestamp)  as date),'yyyy-mm-dd hh24:mi:ss') from jd_userinfo t where t.createdate like '%月%';

select to_date(to_char(cast (cast (createdate  as timestamp)  as date),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') from jd_userinfo t where t.createdate like '%月%';


cast (createdate  as timestamp)  时间戳

cast (cast (createdate  as timestamp)  as date)   转换成date

to_char(cast (cast (createdate  as timestamp)  as date),'yyyy-mm-dd hh24:mi:ss')  转换成字符串


to_date(to_char(cast (cast (createdate  as timestamp)  as date),'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')   标准格式化


缺一个都会报错

0 0
原创粉丝点击