Of course it's slow if you execute each statement as a separate transaction. Put all statements into a single batch transaction:
http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame6.html --- Dan <[EMAIL PROTECTED]> wrote: > my problem is that this tool is to make backup of files. That means > reading some information from a file and then stored in the db. And > that are normally all day over 250000records. We had before a tcl > script that do that on our local machine but we are getting everyting > on our SUN machine now and we decided then to write the new script in > java. > > But now on the problem i wrote this script: > try { > try { > Class.forName("org.sqlite.JDBC"); > } catch (ClassNotFoundException e) { > e.printStackTrace(); > } > Connection conn; > conn = > DriverManager.getConnection("jdbc:sqlite:test.DB"); > // ... use the database ... > for (int i=1; i<=1000; i++) { > stmt = > conn.createStatement().executeUpdate("INSERT INTO RTCC_CDR > VALUES('1')"); > } > conn.close(); > } catch (SQLException e) { > e.printStackTrace(); > } > > And for adding those 1000records it takes 112seconds and you can then > imagine how long it will take for 250000 records so what am I doing > wrong that it is so slow? ____________________________________________________________________________________ Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz --~--~---------~--~----~------------~-------~--~----~ Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en To unsubscribe, send email to [EMAIL PROTECTED] -~----------~----~----~----~------~----~------~--~---
