|
Hi All, I'm trying to implement JAVA application which would write data directly from AS400 to MSSql server. I found Microsoft Type 4 JDBC driver, installed it on AS400, created a program, and here is what I've got : It takes about 10 seconds to write 1000 records over the network. At the begining I thought that it may be a network performance but it's not. Here are the 3 different methods of inserts I've tried but all of them giving me approximately the same numbers , about 1000 inserts per 10 seconds. Question, What am I doing wrong ? or is it possible to write it faster than that at all ? PreparedStatement myPreparedStatment = connection.prepareStatement("insert into TESTTABLE(CUSTOMER_NAME,CUSTOMER_AGE) values(?, ?)"); //CallableStatement myStatement = connection.prepareCall("insert into TESTTABLE(CUSTOMER_NAME,CUSTOMER_AGE) values(?, ?)"); // Execute an update. for(int i =0; i<Var1; i++) { // Method 1 ---------------------------------------------------------------------------- - myPreparedStatment.setString(1, "Test"); myPreparedStatment.setInt(2, i); myPreparedStatment.addBatch(); // Method 1 end ---------------------------------------------------------------------------- // Method 2 ( uncomment Callable statement on the top ---------------------------------------------------------------------------- - // myStatement.setString(1, "Roman Prigozhin"); // myStatement.setInt(2, i); // myStatement.addBatch(); // Method 2 end ---------------------------------------------------------------------------- ------------------------ // Method 3 ---------------------------------------------------------------------------- ------------------------------------------------- // String InsertRecord = "insert into TESTTABLE(CUSTOMER_NAME,CUSTOMER_AGE) values('Roman Prigozhin', "+i+")"; // PreparedStatement ps = connection.prepareStatement(InsertRecord); // int updateCount = ps.executeUpdate(); // ps.close(); // Method 3 end } myPreparedStatment.executeBatch(); connection.commit(); myPreparedStatment.close(); Thanks, Roman Prigozhin www.aadt.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.