日期:2014-05-20 浏览次数:20912 次
import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class JDBC_Test { public static void main(String args[]) { Connection connection = null; Statement statement = null; ResultSet resultSet = null; try { String driverName = "oracle.jdbc.driver.OracleDriver"; Class.forName(driverName); String url = "jdbc:oracle:thin:@127.0.0.1:1521:orcl"; for (int i = 0; i < 1000; i++) { System.out.println("连接到oracl成功!----"+i++); connection= DriverManager.getConnection(url, "bschis", "bschis"); statement= connection.createStatement(); statement.executeQuery("select * from EHR_HealthRecord"); } } catch (Exception e) { e.printStackTrace(); } } }
import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class JDBC_Test { public static void main(String args[]) { Connection[] connection = new Connection[1000]; Statement[] statement = new Statement[1000]; ResultSet resultSet = null; try { String driverName = "oracle.jdbc.driver.OracleDriver"; Class.forName(driverName); String url = "jdbc:oracle:thin:@127.0.0.1:1521:orcl"; for (int i = 0; i < 1000; i++) { System.out.println("连接到oracl成功!----"+i++); connection[i] = DriverManager.getConnection(url, "bschis", "bschis"); statement[i] = connection[i].createStatement(); statement[i].executeQuery("select * from EHR_HealthRecord"); } } catch (Exception e) { e.printStackTrace(); } finally { } } }