[Tutor] Opening and closing SQLite db

Chris Fuller cfuller084 at thinkingplanet.net
Sun Dec 26 16:21:20 CET 2010


You can call the commit() method of the connection object to ensure that any 
changes are saved to disk, but it's strictly optional.  Closely/reopening is 
not necessary.

Cheers

On Sunday 26 December 2010, Timo wrote:
> Hello, I use SQLite in my application as database, but I think I'm doing
> something wrong.
> 
> Currently, I open a connection and cursor object every time I do an
> operation (insert, select, update, ...) and close it afterwards. Now I was
> wondering if it wouldn't be better to open the connection if my application
> starts, and commit and close when the user quits.
> Is this save? Can data be selected if I haven't commit anything?
> 
> Cheers,
> Timo



More information about the Tutor mailing list