[Qt-interest] QSQLITE and Network Shares

Jason H scorp1us at yahoo.com
Fri Nov 13 19:45:11 CET 2009


I would speculate that Qt makes a multithreaded assumption, and even though you're not using it in multithreaded way, Qt might be trying to, you should recompile the driver yourself with your own options. 






________________________________
From: Israel Brewster <israel at frontierflying.com>
To: Jason H <scorp1us at yahoo.com>
Cc: "Qt Interest <(qt-interest at trolltech.com)>" <qt-interest at trolltech.com>
Sent: Thu, November 12, 2009 4:30:15 PM
Subject: Re: [Qt-interest] QSQLITE and Network Shares



On Nov 12, 2009, at 11:42 AM, Jason H wrote:

Well also remember that SQLite is not multithread-safe in all scenarios. It is always multi-process safe.
>

Yeah, you are absolutely right. Thankfully my app has no need to be multi-threaded :)


> http://www.sqlite.org/cvstrac/wiki?p=MultiThreading
>
>Is your library compiled with different options than your binary? Perhaps that is your problem? What would nicely explain why your app and the sqlite3 binary differ in behavior.
>

Thanks for the response. That would certainly explain things. The difficulty here is that I have no idea what options either are compiled with, as they came with the OS. Unlike PostgreSQL and MySQL, I didn't have to download and compile it myself, although doing so may not be a bad idea. I was kinda hoping someone would take the time to run the unit test, so at least I could know if the problem was limited to my machine or the like, but that hasn't happened yet. Oh well. Thanks for the feedback, and trying to help :)


>
>
>
>
>
>
>
________________________________
From: Israel Brewster <israel at frontierflying.com>
>To: Jason H <scorp1us at yahoo.com>
>Cc: "Qt Interest <(qt-interest at trolltech.com)>" <qt-interest at trolltech.com>
>Sent: Thu, November 12, 2009 12:07:42 PM
>Subject: Re: [Qt-interest] QSQLITE and Network Shares
>
>
>
>On Nov 11, 2009, at 7:09 PM, Jason H wrote:
>
>I've seen this problem in Windows. 
>>
>>It is not Qt's fault. If anything it is SQLite's. I've seen it on local files when you have too many connections open, or opened too many in too short of a time period. I just ended up spinning on the error until it goes away. Fortunately for me, it was not anything that was mission critical, just a helper app.
>>
>>I'd see about moving to PostgreSQL, or developing a driver for one of the network wrappers (http://www.sqlite.org/cvstrac/wiki?p=SqliteNetwork) which should get you around the problem you're having. 
>>
>>It would be cool is Qt formally supported one of the networked SQLite wrappers....
>>
>
>
>I don't mean to be a pain here, but I'm puzzled. How can it be SQLite's fault when SQLite, when used directly, works? How can there be "too many connections open" when the ONLY connection open is the one that Qt just opened? Why do people say it will never work, when the SQLite website explicitly says it will (see quote below)? I'm sorry, but I'm having a lot of difficulty accepting that this is a SQLite problem when SQLite works just fine when used directly, and the SQLite website says it should work - the first sentence of that link you sent, actually. What is Qt's SQLite driver doing differently than the command line SQLite3 program that makes it not work, when the command line program does? Has anyone even bothered to try the unit test I attached? Again, I appoligize if I am being pusshy and/or diffuclt here - I probably am. It's just that it is so frustrating to be told that something which works fine everywhere else won't work at all.
>
>
>As far as moving to PostgreSQL, yes, that is a very good solution, and actually one that I have implemented. The problem is that the program in question isn't for me, it's for the general public, and I need an easy way for the general public to be able to "network" my app. Putting a SQLite database on a share, as the SQLite website says is doable, would be the perfect solution for someone who just want's to be able to use the app on whichever computer they happen to be on at the moment. PostgreSQL is a much better solution overall, but requires significantly more knowledge and computing resources. My program implements both, depending on user preference.
>
>
>>
>>
>>
>>
>>
________________________________
From: Israel Brewster <israel at frontierflying.com>
>>To: Sylvain Pointeau <sylvain.pointeau at gmail.com>
>>Cc: "Qt Interest (qt-interest at trolltech.com)" <qt-interest at trolltech.com>
>>Sent: Wed, November 11, 2009 1:50:18 PM
>>Subject: Re: [Qt-interest] QSQLITE and Network Shares
>>
>>
>>On Nov 11, 2009, at 8:42 AM, Sylvain Pointeau wrote:
>>
>>SQLite needs to put a lock on the file, but the network drives have all a issue with that.
>>>it is explained on the sqlite website.
>>
>>
>>Thanks for the response. However, the problem can not be an inherent SQLite problem because, as I explained in my original message, the sqlite command-line utility works fine this way, even on the same file created by Qt. Actually, on the SQLite website it is explained that it SHOULD work just fine for low volume usage (which this obviously is) -that's why I am trying it. They do point out some caveats with windows or NFS shares, where it SOMETIMES (not always) doesn't work, but I am not using either. To quote (from http://www.sqlite.org/cvstrac/wiki?p=SqliteNetwork ):
>>
>>
>>Using SQLite on a Network
>>SQLite database files may be shared accross a network using a network filesystem.
>>
>>
>>They go on to say it won't be particularly efficient (which I don't care about, at least at the moment), and that it may have problems with certain file systems (specified elsewhere as NFS and FAT, neither of which I am using), but the point is it should work. And does, at least from the command line. It is just Qt that has problems with this, at least on my system. So the question really is, is this an inherent problem with Qt, or just a problem with my build? Thanks for any help!
>>
>>
>>>
>>>I fear that there is no solution to your problem...
>>>
>>>
>>>Cheers,
>>>Sylvain
>>>
>>>
>>>On Wed, Nov 11, 2009 at 6:25 PM, Israel Brewster <israel at frontierflying.com> wrote:
>>>
>>>If it helps, I am attaching a simple unit test case that illustrates the problem, at least on my system. If this doesn't occur for other people, I would be interested in knowing that too. The test asks you to select a location for a database, and then creates it and attempts a simple CREATE TABLE and SELECT. On my machine, if I select a local directory, it works. If I select a mounted network share, it fails. As stated, I am running Mac OS X 10.5.8 with Qt 4.5.2. The share is an AFP share (I also tried with a SMB share, same result). Thanks for any help that can be provided!
>>>>
>>>>
>>>>
>>>>
>>>>On Nov 10, 2009, at 2:36 PM, Israel Brewster wrote:
>>>>
>>>>Running Mac OS X 10.5, Qt 4.5.2. I am having a problem using QSqlDatabase with the SQLITE driver if the database file is located on a network share. The database opens fine, being created if it doesn't exist (QSqlDatabase::open returns true), but as soon as I try to do anything with the database (such as select) I get an error saying "database is locked Unable to execute statement" - this happens even if the database file didn't exist prior to the call to open, which takes place immediately before the attempted SQL execution. If I use the command line version of SQLite on the same file, it works fine. Also, the same file, if moved to a local directory, works - the problem only occurs when the database is on a network share.. What can I do to fix this issue? Thanks.
>>>>>
>>>>>
>>>>>-----------------------------------------------
>>>>>Israel Brewster
>>>>>Computer Support Technician II
>>>>>Frontier Flying Service Inc.
>>>>>5245 Airport Industrial Rd
>>>>>Fairbanks, AK 99709
>>>>>(907) 450-7250 x293
>>>>>-----------------------------------------------
>>>>>
>>>>><Israel Brewster.vcf>
>>>>>
>>>>>_______________________________________________
>>>>>Qt-interest mailing list
>>>>>Qt-interest at trolltech.com
>>>>>http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>>>
>>>>
>>>>
>>>>-----------------------------------------------
>>>>Israel Brewster
>>>>Computer Support Technician II
>>>>Frontier Flying Service Inc.
>>>>5245 Airport Industrial Rd
>>>>Fairbanks, AK 99709
>>>>(907) 450-7250 x293
>>>>-----------------------------------------------
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>_______________________________________________
>>>>Qt-interest mailing list
>>>>Qt-interest at trolltech.com
>>>>http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>>
>>>>
>>>
>>
>>-----------------------------------------------
>>Israel Brewster
>>Computer Support Technician II
>>Frontier Flying Service Inc.
>>5245 Airport Industrial Rd
>>Fairbanks, AK 99709
>>(907) 450-7250 x293
>>-----------------------------------------------
>>
>>
>>
>>
>>
>
>-----------------------------------------------
>Israel Brewster
>Computer Support Technician II
>Frontier Flying Service Inc.
>5245 Airport Industrial Rd
>Fairbanks, AK 99709
>(907) 450-7250 x293
>-----------------------------------------------
>
>
>
>
>

-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091113/aae775eb/attachment.html 


More information about the Qt-interest-old mailing list