I am using sqlite database for a lineup of consumer producers.
One or more producers INSERT one line at a time with a new automatic incremental primary key.
There is one consumer (implemented in java, uses the sqlite-jdbc library ), and I want it to read a batch of rows and delete them. It sounds like I need transactions for this, but trying to use SQLite with transactions seems wrong. Can I say this?
If I really need transactions, what's the right way to do this in Java?
Connection conn;
boolean success = false;
try {
success = true;
}
finally
{
if (success)
conn.commit();
else
conn.rollback();
}
source
share