waterye

show full processlist

shell
mysql -h 192.168.0.136 -P 3306 -N -u root -p'abcd' -e 'show full processlist' | egrep -v 'Sleep|show full processlist'
jsp
String sql = " show full processlist ";
rs
= stmt.executeQuery(sql);
while (rs.next()) {
String id
= rs.getString("Id");
String user
= rs.getString("User");
String host
= rs.getString("Host");
String db
= rs.getString("db");
String command
= rs.getString("Command");
String info
= rs.getString("Info");
String state
= rs.getString("State");
if (command.equalsIgnoreCase("Sleep")) continue;
if (info.equalsIgnoreCase("show full processlist")) continue;
if (info.length()==0 && state.length()==0) continue;
int time = rs.getInt("Time");
// print
}

posted on 2008-09-12 00:42 waterye 阅读(559) 评论(0)  编辑  收藏 所属分类: mysql