|
Hi Roman, Just this past week I had to do the same thing, connect from the as400 to a SQL Server db. I successfully found and used the opensource jTDS driver in SourceForge (I have included a link to the jTDS project below). It appears to be the preferred driver for handling this (according to many articles I found), and is also supposed to be faster than the driver you are using. http://jtds.sourceforge.net/ Good Luck, Ivan --- Roman Prigozhin <Roman.Prigozhin@xxxxxxxxxxxxxxx> wrote: > 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 > _______________________________________________ > This is the Java Programming on and around the > iSeries / AS400 (JAVA400-L) mailing list > To post a message email: JAVA400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: > http://lists.midrange.com/mailman/listinfo/java400-l > or email: JAVA400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the > archives > at http://archive.midrange.com/java400-l. > __________________________________ Do you Yahoo!? Yahoo! Tax Center - File online by April 15th http://taxes.yahoo.com/filing.html
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.