Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Write-Ahead Logging of SQLite in java program

I want to use the Write-Ahead Logging feature of SQLite in a j2se program. Please help me with a java implemention example.

like image 335
Vivek Avatar asked Mar 07 '26 14:03

Vivek


1 Answers

You need to execute a Sqlite specific command (just like you'd execute other SQL queries):

pragma journal_mode=wal

For the specifics of using this pragma, please read http://www.sqlite.org/pragma.html#pragma_journal_mode

Here are some highlights:

  • Your Sqlite library must be >= 3.7.0.
  • This journal_mode is persistent (or sticky), ie you'll need to disable it explicitly if you want to access your database with a < 3.7.0 Sqlite.