Heisenbug
Heisenbug

Reputation: 39164

executing an update to an sqlite database through jdbc sometimes don't work

I have a Java application connected to a sqlite database through jdbc. Sometimes executing an update don't work. The SQL syntax is right, no exception is thrown and the return value of executeUpdate is 1. The statement is closed after the execution.

I have found a workaround to this situation closing the connection to the database after executing the query, but I don't like this approach.

What could be the problem?

Upvotes: 0

Views: 374

Answers (1)

Chad Wilson
Chad Wilson

Reputation: 121

Are you using multiple threads to access the database? SQLite is single threaded (sort of see http://www.sqlite.org/cvstrac/wiki?p=MultiThreading). As mentioned there, "Do not use the same database connection at the same time in more than one thread".

Upvotes: 1

Related Questions