How to use sqlite pragmas - or how to set synchronize options?

42 views
Skip to first unread message

mifri...@gmail.com

unread,
Jun 13, 2015, 8:06:59 AM6/13/15
to ormlit...@googlegroups.com
Hi,

I would like to use ormlite+sqlite on Linux Unluckily, sqlite is very slow in terms of write performance until someone disables synchronize.

If I unterstood it right, this needs to happen on a connection-base. Even if I try to do something like 

DatabaseConnection dc = connectionSource.getReadWriteConnection();
dc.setAutoCommit(false);
dc.executeStatement("PRAGMA synchronous = NORMAL",
DatabaseConnection.DEFAULT_RESULT_FLAGS);
dc.executeStatement("PRAGMA journal_mode = TRUNCATE",
DatabaseConnection.DEFAULT_RESULT_FLAGS);

dc.executeStatement("PRAGMA page_size = 4096",
DatabaseConnection.DEFAULT_RESULT_FLAGS);

it bails out saying it is still on a transaction or it can't be changed while in a transaction (depends whether auto commit is off or on)
So - how do I archive this?

Best regards,
Michael Fritscher
Reply all
Reply to author
Forward
0 new messages