简体   繁体   English

如果使用SQLite JDBC,连接速度慢

[英]Slow connection in case of SQLite JDBC

I have a Java code that works with SQLite in the following way: 我有一个可通过以下方式与SQLite一起使用的Java代码:

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! 我注意到getConnection调用至少持续10秒! 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). 对我来说,问题是从Java 6 JDK升级到Java 8时开始的。切换回Java 6(通过从/ Library / Java / JavaVirtualMachines中删除.jdk文件)大大加快了我的JDBC SQLite查询(我估计是通过系数10到100)。

I'm running OS X Mavericks. 我正在运行OS X Mavericks。 I tried the Java 7 SDK, and it was also slow for me. 我尝试了Java 7 SDK,这对我来说也很慢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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