import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; /** * */ public class JDBCCompressTest { protected static String driver = "com.mysql.jdbc.Driver"; protected static String url = "jdbc:mysql://192.168.23.115:3308/test?autoReconnect=true&characterEncoding=utf8&useCompression=true"; protected static String user = "root"; protected static String password = "aicent"; public static Connection getConnection() { try { Class.forName(driver); return DriverManager.getConnection(url, user, password); } catch (ClassNotFoundException e) { System.out.println("Can't find mysql driver!"); e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } public static void main(String[] args) { int testSize = 63000; String sql = "select * from ipx_gateway_dbcon_test"; System.out.println("testSize = " + testSize); for(int i=0; i< testSize; i++){ try { Connection conn = getConnection(); Statement sm = conn.createStatement(); ResultSet rs = sm.executeQuery(sql); rs.next(); sm.close(); rs.close(); conn.close(); Thread.sleep(1000); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } System.out.println("Done"); //Let it run for a while so I can monitor the java process. try{ Thread.sleep(60*60*1000); }catch(InterruptedException ex){} } }