Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sqlite INSERT INTO over java very slow

843859Aug 6 2007 — edited Aug 7 2007
Hi I downloaded the SQLiteJDBC to create a java application that will
run on a SUN machine.
But first I am developping the tool on a windows machine P4 2.81GHz 1G
RAM.

I created a simple SQLite database with a varchar column. I am
creating the tool on eclpise and imported the native jar file to the
project, that works fine connection to db will be done and so on. But
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 because we didn't get running the tclscricpt on the SUN machine (didn't found the tclsqlite.so for solaris).

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 (+-14hours)so what am I doing
wrong that it is so slow?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2007
Added on Aug 6 2007
3 comments
1,622 views