On Dec 21, 2009, at 12:40 PM, Chris Parker wrote:

> We have an application that attaches 2 java threads that establish  
> their
> own connection to SQLite databases. While one is running (loading a
> table), the other thread attempts an ATTACH DATABASE command and
> receives a "cannot ATTACH database within transactions".   A  
> transaction
> has been started in the first thread and not the second.  Based on  
> what
> I can see in the SQLite FAQ, there is no caveats to multi-threaded
> applications, so I don't understand why this would occur.

I'm guessing that something in your application that you are unaware  
of is starting a transaction on the second thread, or perhaps failing  
to close a prior transaction.  The sqlite3_get_autocommit() interface  
will tell you whether or not your database connection is currently in  
a transaction.  Why don't you print out the result of that API call  
just prior to doing the ATTACH and see what you find?


>  Any help on
> understanding what we should be doing differently is appreciated.  We
> MUST use transactions to load the database, so disabling this is not  
> an
> option.
>
> Thanks,
> Chris
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

D. Richard Hipp
d...@hwaci.com



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to