首页 > 其他 > 详细

查询死锁

时间:2021-05-26 09:23:56      阅读:26      评论:0      收藏:0      [点我收藏+]
    public void getLockInfo() throws ClassNotFoundException, SQLException {
        log.info("开始执行SQL语句查询Lock信息");
        Class.forName("com.mysql.cj.jdbc.Driver");
        Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/devtools?characterEncoding=utf-8&useSSL=false", "root", "pas");
        PreparedStatement preparedStatement = connection.prepareStatement("show engine innodb status");
        ResultSet resultSet = preparedStatement.executeQuery();
        while (resultSet.next()) {
            String type = resultSet.getString("Type");
            String status = resultSet.getString("Status");
            String[] statusList = status.split("\n");

            for (String st : statusList) {
                log.info("hh - {}", st);
            }
        }


        log.info("结束执行SQL语句查询Lock信息");
    }

查询死锁

原文:https://www.cnblogs.com/hlssz/p/14811627.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!