Re: [sqlite] Question about having 2 db connections on same thread
> I do a transaction on connection 1 using BEGIN IMMEDIATE, some rows updated, > COMMIT. > Then, when I attempt same sequence on connection 2, when I do first call to > step > to execute begin transaction and it never returns. Do you check result code from COMMIT and is it successful? My guess is you have some SELECT statements which are not reset or finalized before COMMIT. And your COMMIT in such situation should return SQLITE_BUSY. If that's true then second BEGIN IMMEDIATE just can't finish because another writing transaction is not finished yet. Pavel On Sun, Feb 13, 2011 at 6:04 PM, jeff archer wrote: > I thought this would be OK but now that I am seeing it fail I am having my > doubts. > > > I have created 2 db connections on the same thread, both on the same file. > i.e. > 2 calls to sqlite3_open16() (use exact same filename both times) have created > 2 > sqlite3 instances. I do this because I have 2 classes which each have their > own > set of tables in this single db file. I thought it would be OK because I do > not > intemix operations on the 2 connections. > > I do a transaction on connection 1 using BEGIN IMMEDIATE, some rows updated, > COMMIT. > Then, when I attempt same sequence on connection 2, when I do first call to > step > to execute begin transaction and it never returns. > > Jeff Archer > Nanotronics Imaging > jsarc...@nanotronicsimaging.com > <330>819.4615 > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Question about having 2 db connections on same thread
On 14 Feb 2011, at 12:30am, Vannus wrote: > Are you not able to use the same db connection in both classes? > > something like > FirstTablesClass->dbConnection = MyDBConnectionClass > SecondTablesClass->dbConnection = MyDBConnectionClass Nevertheless, having two connections should work too. His description doesn't include anything that looks obviously wrong to me. I don't see why he's having the problem. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Question about having 2 db connections on same thread
Are you not able to use the same db connection in both classes? something like FirstTablesClass->dbConnection = MyDBConnectionClass SecondTablesClass->dbConnection = MyDBConnectionClass On 13 February 2011 23:04, jeff archer wrote: > I thought this would be OK but now that I am seeing it fail I am having my > doubts. > > > I have created 2 db connections on the same thread, both on the same file. > i.e. > 2 calls to sqlite3_open16() (use exact same filename both times) have > created 2 > sqlite3 instances. I do this because I have 2 classes which each have > their own > set of tables in this single db file. I thought it would be OK because I > do not > intemix operations on the 2 connections. > > I do a transaction on connection 1 using BEGIN IMMEDIATE, some rows > updated, > COMMIT. > Then, when I attempt same sequence on connection 2, when I do first call to > step > to execute begin transaction and it never returns. > > Jeff Archer > Nanotronics Imaging > jsarc...@nanotronicsimaging.com > <330>819.4615 > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users