Question

I am facing an SQLite error though I am not using any explicit AutoCommit true or false. can anyone provide any input on this error. What are the situation where you will get this error.

Thanks in advance. Regards, Manasi Save

Was it helpful?

Solution

I faced a similar problem repeatedly (in my case it was a rollback that was not possible) when I was inside a loop looping over table entries. As long as the cursor is processing the entries, an SQL statement is "in progress". I don't know exactly, if this also prohibits commits, but it could be.

When you try to process table entries and insert entries in the same or a different table, you might want to try to collect the data in memory and after the loop do the inserts or updates.

Addtitional info: "Autocommit" normally defaults to "True" in SQLite (it of course could also depend on the access layer you use -- I am using Python and apsw, so I can't tell you more about this in Java). This means, that every insert is autocommited immediatly.

==> this could be an other solution. Instead of storing the data in memory, you could try to explicitly open a transaction and commit it after the loop -- this way, the problem should go also away.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top