查询死锁

    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信息");
    }
上一篇:JDBC工具类


下一篇:JDBC工具类