java.sql.SQLException: Lock wait timeout exceeded;

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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值