msegmx
12-16-02, 12:30
| hello, our web server and db2 server are on different servers (win2k). in my web application (jsp) i have to do insertions into a db2 table. now, i could use: st.executeUpdate("insert into mytable (columnA, columnB, columC) values (45, 3, 'dummyString1'), (45, 3, 'dummyString2'), (35, 2, 'dummyString3'), .... , (51, 6, 'dummyString98'), (51, 7, 'dummyString99), (51, 7, 'dummyString100')"); using this method, i had only to pass one 'big' insertion statement to db2 and all is done. but i could use this : ps = cn.prepareStatemnt("insert into mytable (columnA, columnB, columnC) values (?, ?, ?)"); for (int x = 0; x < 100; ++x) { ps.setInt(1, array1[x]); ps.setInt(2, array2[x]); ps.setString(3, array3[x]); ps.executeUpdate(); } what is 'better' here, going to the db2 server 100 times with a prepared statement and increase network traffic , or concatenate a big string and send it once using a statement ? your comments are appreciated. thanks in advance. Mehmet Gunacti mserkan@gmx.net |