Use one Connection instance per thread. If you have lots of threads,
put them in a pool.

d.

2008/7/1  <[EMAIL PROTECTED]>:
>
> Hi All,
>
> I was wondering if somebody could orient me on how to safely use the
> SQLite JDBC with threads... right now, I get strange errors that I
> think result from threads colliding while using the Connection
> object.  There are two threads using the DB Connection: one writes a
> few rows once per second, using setAutoCommit(false) and true, the
> other reads probably a few dozen rows per second, some from the same
> table the other thread writes to. Every few minutes, I am getting a
> SQLException - I think the error is something like "missing database
> or logic error"...   Both threads are using the same Connection
> object.
>
> I wanted to find out if there is a way for my processes to determine
> if the connection is being used by the other thread.  I could
> implement synchronized lock and unlock functions that I call before
> and after all my DB access, but I suspect there's a more elegant way
> to do it.  Can anybody offer some pointers?  I would appreciate it.
>
> Thanks,
> Dan
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to