sqlite jdbc setJournalMode -
i running first trials on sqlite (with jdbc) pure memory database. need fast inserts tried set config accordingly. find out code below fails @ setting journalmode. please refer method shown below. variables con , isconnected defined class vars , not shown here.
thanks lot
rolf
public boolean connect() { try { class.forname("org.sqlite.jdbc"); // sqlitejdbc_3.7.2 // set pragmas sqliteconfig config = new sqliteconfig(); // statement (journalmode setting) causes fail // without statement connection can established // ==> java.sql.batchupdateexception: batch entry 0: query returns results config.setjournalmode(journalmode.memory); config.settempstore(tempstore.memory); config.setsynchronous(synchronousmode.off); config.enforceforeignkeys(false); config.enablecountchanges(false); con = drivermanager.getconnection("jdbc:sqlite::memory:", config.toproperties()); isconnected = true ; return true ; } catch (exception e) { logmessages.instance().print(0, logmessages.msg_severity.error, e.getmessage() + "\n"); e.printstacktrace() ; return false ; } }
i have same issue, there other way disable it. after opening connection can execute query : pragma journal_mode=memory;
Comments
Post a Comment