// 连接到数据库的四大属性
private static final String DRIVER = "oracle.jdbc.driver.OracleDriver";
private static final String DBURL = "jdbc:oracle:thin:@127.0.0.1:1521:orcl";
private static final String USER = "system";
private static final String PSWD = "XXXX";
public void batchInsert(int count) {
Connection conn = null;
Statement stmt = null;
long startTime = System.currentTimeMillis();
Class.forName(DRIVER).newInstance();
conn = DriverManager.getConnection(DBURL, USER, PSWD);
stmt = conn.createStatement();
int BatchSize=100;
int index=0;
int times=count/BatchSize;
for(int i=0;i
0) {
retval = days + "d" + hours + "h" + minutes + "m" + strSeconds;
} else if (hours > 0) {
retval = hours + "h" + minutes + "m" + strSeconds;
} else if (minutes > 0) {
retval = minutes + "m" + strSeconds;
} else {
retval = strSeconds;
return retval;
* 执行点
* @param args
public static void main(String[] args) {
MillionInserter mi=new MillionInserter();
mi.batchInsert(1000000);
#9987 100 records inserted
#9988 100 records inserted
#9989 100 records inserted
#9990 100 records inserted
#9991 100 records inserted
#9992 100 records inserted
#9993 100 records inserted
#9994 100 records inserted
#9995 100 records inserted
#9996 100 records inserted
#9997 100 records inserted
#9998 100 records inserted
#9999 100 records inserted
Time elapsed:9m17s
当前记录数:1000000
到此真正掌握了Oracle的Insert ALL语法,并确认了其真实效率,今天又取得了一个小小的突破,重走长征路又迈出了小小却坚实的一步。
--END-- 2019年11月9日11:19:01