I have a rather confusing and strange problem using JDBC on an old Oracle server (it's 8i, as I was told). I prepared a table with about 10 columns, numbers, varchars, raw (255) and some dates in it, without restrictions, without keys, etc. From this side, everything is quickly assumed. Subsequently, my application seemed very slow (pasting 25,000 data in about 30-50 seconds ...). My environment is almost the last 1.6 JDK, ojdbc14 driver from 10.2.0 Oracle. So I cut this piece of code and tested these things separately. Some background information about the code, its essential parts here
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("thin url", "user", "pass");
conn.setAutoCommit(false);
PreparedStatement pstmt = conn.prepareStatement(SQL_STMT);
for(int i = 0; i < numOfData; ++i) {
pstmt.setObject(objects[i]);
pstmt.addBatch();
}
pstmt.executeBatch();
conn.commit();
conn.setAutoCommit(true);
pstmt.close();
conn.close();
, . H2 DB, , 0 500 000 , (, 0 , , ). ojdbc6 . , ojdbc14 jdk 1.6.idontknow .
ojdbc14 executeBatch FINEST, , , , oracle.jdbc.driver.DBConversion.stringToDriverCharBytes . , " ", . Commiting, pstmt .. , executeBatch.
FYI jdbc , .
, ? , ?