注意:此文档是本人由学习整理而成
import java.sql.*;
import oracle.jdbc.driver.*;
class ConOra {
public static void main(String args[] ) throws SQLException{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.152:1521:whx","system","lukewhx");
PreparedStatement stmt ;
ResultSet rset ;
String v_sql;
/*
for (int i =1;i<=1000;i++){
v_sql="select object_name from objects where object_id="+i;
stmt =conn.prepareStatement(v_sql);
rset=stmt.executeQuery();
stmt.close();
}
*/
for (int i =1 ;i<=1000;i++ ) {
v_sql = "select object_name from objects where object_id= :x ";
stmt=conn.prepareStatement(v_sql);
stmt.setString(1,Integer.toString(i));
rset = stmt.executeQuery();
stmt.close();
}
System.out.println("Execute OK");
}
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/50509/viewspace-174241/,如需转载,请注明出处,否则将追究法律责任。