Not rude -- just a communications problem... There's a difference between read-only and exclusive. Read-only just means you can't do inserts and creates. It's not the write mode of the database that matters. It's the transactions you run. read/write with insert/create might make selects and other inserts return BUSY. What you're thinking of is exclusive access -- where only one process can access the database at a time and you don't need any locks. If you're only doing one select or join you won't gain much by exclusive access as your only doing a couple of locks. If you open a databse read-only, and I open it read-write -- I'll make you BUSY if I do an INSERT -- and you'll make me BUSY if you do a select -- I can' INSERT data until you release your READ-LOCK. I'm making a few assumption about sqlite3 here...but I believe this is the way it works. Michael D. Black Senior Scientist Northrop Grumman Mission Systems
________________________________ From: sqlite-users-boun...@sqlite.org on behalf of Sam Carleton Sent: Mon 5/17/2010 1:15 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] read only databases and in-memory databases Michael, I really don't mean to be rude, but I know about the SQLITE_BUSY and that it must be handled and all that good stuff, am I handling it right now? No; will I? Yes, but that isn't my issue, I understand I need to handle those conditions and I am confident that I know how to handle that condition. My question is real simple: Can I open a DB in read-only and then attach a :memory: db to it and write to the :memory: db? Or must the file DB be opened in read/write? Oh, more to your question, let me ask you if this following assumption is correct: *If you only need read-only access, open it in read-only, fore it plays nicer with other threads that are also doing read-only operations.* Sam On Mon, May 17, 2010 at 10:48 AM, Black, Michael (IS) < michael.bla...@ngc.com> wrote: > By "breakdown in communications" you must mean lost data or incomplete > results. > > That's probably the SQLITE_BUSY error you're probably running into and not > handling. > > You'll stil hit the problem opening the database as read-only in the other > cases. > > You can't do a query or a join when the database is busy. It could be busy > writing or reading, either way. > > If you've got multiple clients hitting the database at the same time you > need to handle all the error returns that can occur at every step of the > way. > > If you could show us some of your code we'll be glad to point it out to > you. > > See this thread where it was discussed quite a bit > > http://sqlite.org:8080/cgi-bin/mailman/private/sqlite-users/2010-May/021263.html > > > > Michael D. Black > Senior Scientist > Northrop Grumman Mission Systems > > > ________________________________ > > From: sqlite-users-boun...@sqlite.org on behalf of Sam Carleton > Sent: Mon 5/17/2010 9:04 AM > To: General Discussion of SQLite Database > Subject: Re: [sqlite] read only databases and in-memory databases > > > > On Mon, May 17, 2010 at 9:32 AM, Black, Michael (IS) < > michael.bla...@ngc.com > > wrote: > > > Well...you don't say what "problem" your customers are having. Would be > > nice to know for us to help you. > > > > At this point in time I am purely theorizing, the client is seeing a break > down in communications between the Silverlight application and the Axis2/C > Web Service. I am mentally going through things looking for wholes in my > code. It dawned on me that there is this one case which is really a > read-only call, but because of the temp table I open the DB as read/write. > My goal is to only open the DB as read/write when I REALLY need to open it > as read/write. In the case I described in the original post, I am hoping > to > find a solution to open the DB as read only. > > Sam > _______________________________________________ > 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 > > _______________________________________________ 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