[問題] java sqlite getConnection速度很慢
請教各位
請問有人使用過jdbc去連接sqlite嗎
因為我發現每次程式一起來, 我去getConnection()這一步
都會很慢, 執行時間最長有到7sec, 不知道有沒有前輩欲過類似問題呢?
public Connection getConnection() throws SQLException
{
Connection con = null;
SQLiteConfig config = new SQLiteConfig();
// config.setReadOnly(true);
config.setSharedCache(true);
config.enableRecursiveTriggers(true);
SQLiteDataSource ds = new SQLiteDataSource(config);
ds.setUrl("jdbc:sqlite:config/sample.db");
logger.debug("before getConnection");
con = ds.getConnection();// <----就是這一步,會執行很久@@
logger.debug("after getConnection");
return con;
//ds.setServerName("sample.db");
}
謝謝大家
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.81.103.94
※ 文章網址: https://www.ptt.cc/bbs/java/M.1435550839.A.00C.html
推
06/29 15:49, , 1F
06/29 15:49, 1F
→
06/29 16:30, , 2F
06/29 16:30, 2F
→
06/29 16:31, , 3F
06/29 16:31, 3F
→
06/30 07:36, , 4F
06/30 07:36, 4F
→
06/30 07:38, , 5F
06/30 07:38, 5F
→
06/30 12:22, , 6F
06/30 12:22, 6F
推
06/30 14:22, , 7F
06/30 14:22, 7F
→
06/30 14:23, , 8F
06/30 14:23, 8F
→
06/30 14:23, , 9F
06/30 14:23, 9F
java 近期熱門文章
PTT數位生活區 即時熱門文章