You can retain and reuse the Connection
, saving it probably in some static field. If you access it from multiple threads, SQLite must work in the Serialized mode. You must have the code somewhere to re-establish the connection if it has been lost for some reason.
If the use of Connection
is not heavy, you can also have some method that opens it and close when no longer needed, better inside the finally
block.