简体   繁体   中英

Slow connection in case of SQLite JDBC

I have a Java code that works with SQLite in the following way:

try {

    Class.forName("org.sqlite.JDBC");

} catch (ClassNotFoundException ex) {

    // ...

}

try {

    conn = DriverManager.getConnection("jdbc:sqlite:helper.db");

} catch (SQLException ex) {

    // ...

}

I notice that getConnection call lasts at least 10 sec! Why? And how can i increase the speed in this case?

This might be too late to help you, but I'm having a similar problem. For me the problem started when I upgraded from Java 6 JDK to Java 8. Switching back to Java 6 (by removing the .jdk file from /Library/Java/JavaVirtualMachines) sped up my JDBC SQLite queries considerably (I'd estimate by a factor of 10 to 100).

I'm running OS X Mavericks. I tried the Java 7 SDK, and it was also slow for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM