赞
踩
批处理demo
- Connection conn = C3P0Util.getConnection();
- PreparedStatement ps = null;
- String sql = "insert into t_user values(null,?)";//定义sql的格式
- ps = conn.prepareStatement(sql);
- for (int i = 0; i < 10000; i++) {
- ps.setString(1, "user" + i);
- ps.addBatch(); //将sql语句保存起来,先不执行
- }
- ps.executeBatch();//执行批处理中所有的sql语句
- ps.clearBatch();//清空批处理
查看mysql连接数与客户端ip
SELECT substring_index(host, ':',1) AS host_name,state,count(*) FROM information_schema.processlist GROUP BY state,host_name;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。