Error: Unable to open the database file

Mike Bonner bonnmike at gmail.com
Wed Apr 6 09:20:44 EDT 2016


You can write your own middleware using LC server if you have it set up on
your remote.  I'm afraid I don't know enough about sqlite concurrency
issues and how to handle them, but since the server that has your sqlite is
an http server (I think most of us had been thinking it was a local network
share of some type) middleware would be the way to go. Or switch to mysql..

Ask pete or.. well, there are a ton of people on here who can advise on the
multi-user use of sqlite and its pitfalls and workarounds.

On Wed, Apr 6, 2016 at 7:05 AM, Ray <ray at linkit.com> wrote:

> I thought of downloading it, updating it, and then putting it back on the
> server but that wouldn't work if two users simultaneously did so.  Since
> I'll have many users using the database simultaneously everything has to be
> done on the server.  I know only one user can write to an sqLite database
> at a time, but that only takes about 20 milliseconds if done on the server
> and the other writes get cued, something that wouldn't happen in the
> download/re-upload scenario.
>
> I do like your suggestion regarding middleware on the server to update it
> in place.  You wouldn't happen to have any experience with something that
> works well in this scenario would you?  Something which works well with
> Livecode, an sqLite database, and on a Linux server?
>
>
> On 4/5/2016 11:20 PM, Mike Bonner wrote:
>
>> Ah. Do you need to update the file in place, or just be able to use it
>> with
>> your app?  If the second, you might put url "
>> http://54.210.118.224/Downloads/yourfile.sqlite" into URL
>> (specialfolderpath("tmp") & "/yourfile.sqlite")
>>
>> at which point you can use revopendatabase to open the local copy of the
>> file at (specialfolderpath("tmp") & "/yourfile.sqlite")
>>
>> If you need to be able to update the file in place you'd probably be
>> better
>> off using middleware on the web server and send your requests that way.
>>
>> On Tue, Apr 5, 2016 at 8:51 PM, Ray <ray at linkit.com> wrote:
>>
>> Mike - if I set the folder to the area I've set up to work with this, "
>>> http://54.210.118.224/Downloads/", I get "can't open that directory"
>>> returned in the result.  I can read files at that location but I get an
>>> "error 405 method not allowed" if I try to write files to that location.
>>> Could that be the problem?
>>>
>>> Regarding mapping the server to a drive letter or mounting it to a folder
>>> on the local system, even if that worked I wouldn't be able to expect my
>>> end users to do that so it's kind of out unless I'm missing something.
>>>
>>> Thanks for your input and let me know if anything else comes to mind.
>>>
>>> On 4/5/2016 10:33 PM, Mike Bonner wrote:
>>>
>>> can you map the server to a drive letter?  (or mount it to a folder on
>>>> the
>>>> local system)  If so, that might help.
>>>>
>>>> Alternatively, can you "set the folder.." to a path on the server and
>>>> see
>>>> "the files"?  If you can successfully set the default folder, then you
>>>> can
>>>> just supply the filename and see if it behaves differently.
>>>>
>>>> On Tue, Apr 5, 2016 at 5:58 PM, Ray <ray at linkit.com> wrote:
>>>>
>>>> I did read some about the file locking issues so I'll continue to look
>>>>
>>>>> into that.
>>>>>
>>>>> Regarding testing with sqLite3, I'm not sure what to do with it.  I
>>>>> downloaded the pre-compiled binary for Windows 64.  It gave me 2 files,
>>>>> sqlite3.def and sqlite3.dll but I'm not sure what to do with them.
>>>>> Shell
>>>>> commands from within Livecode don't work.  Suggestions?
>>>>>
>>>>>
>>>>> On 4/5/2016 7:22 PM, Peter Haworth wrote:
>>>>>
>>>>> I suppose I should also mention the usual caveat about using sqlite
>>>>> over
>>>>>
>>>>>> a
>>>>>> networked file system, which is that sqlite relies on file system
>>>>>> locking
>>>>>> to preserve data integrity and some networked file systems are buggy
>>>>>> in
>>>>>> that area according to the sqlite website.
>>>>>>
>>>>>> On Tue, Apr 5, 2016, 3:57 PM Ray <ray at linkit.com> wrote:
>>>>>>
>>>>>> Peter - thanks for jumping in here.  Yes, I can read and write files
>>>>>> to
>>>>>>
>>>>>> this location and, as a matter of fact, I can even do a straight read
>>>>>>> of
>>>>>>> the database file on the server and get the same cryptic characters
>>>>>>> back
>>>>>>> I get when I read the local copy.  I just can't establish a
>>>>>>> connection
>>>>>>> to it for the purpose of issuing revDatabase calls.
>>>>>>>
>>>>>>> You're right when you say the "unable to open the database file" is
>>>>>>> not
>>>>>>> very informative.  I get the same message when I try that on an empty
>>>>>>> path on the server.
>>>>>>>
>>>>>>> I'll try your sqLite3 suggestion and let you know how it works.
>>>>>>>
>>>>>>> Thanks!
>>>>>>>
>>>>>>> On 4/5/2016 6:34 PM, Peter Haworth wrote:
>>>>>>>
>>>>>>> You might want to try opening the database with something other than
>>>>>>>
>>>>>>>> Livecode in hope that you will get a more informative error message.
>>>>>>>>      sqlite3 is the official sqlite command line tool.  It's
>>>>>>>> distributed
>>>>>>>>
>>>>>>>> with
>>>>>>>>
>>>>>>> OSX but not sure if it's included with Windows.
>>>>>>>
>>>>>>>> Are you able to access any other files in the same directory as the
>>>>>>>>
>>>>>>>> sqlite
>>>>>>>>
>>>>>>> db?
>>>>>>>
>>>>>>>> On Tue, Apr 5, 2016 at 1:31 PM Ray <ray at linkit.com> wrote:
>>>>>>>>
>>>>>>>> Devin - thanks for the idea but that's not it.  I just checked and
>>>>>>>>
>>>>>>>> everything on my Windows 8.1 system matches case with the database
>>>>>>>>> file
>>>>>>>>> path on the Linux server.  I even tried changing the name of the
>>>>>>>>> database file to all lower case but that didn't work either.
>>>>>>>>> Thanks...
>>>>>>>>>
>>>>>>>>> On 4/5/2016 3:38 PM, Devin Asay wrote:
>>>>>>>>>
>>>>>>>>> Ray,
>>>>>>>>>
>>>>>>>>>> You may have moved your DB file from a system that is not case
>>>>>>>>>>
>>>>>>>>>> sensitive, like MacOS, to one this is case sensitive, like Linux.
>>>>>>>>>> Do
>>>>>>>>>>
>>>>>>>>> all of
>>>>>>>>>
>>>>>>>> your folders and file names have the same exact spelling, including
>>>>>>>> upper
>>>>>>>> and lower case letters, as the string in your path variable?
>>>>>>>>
>>>>>>>> Devin
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Apr 5, 2016, at 12:39 PM, Ray <ray at linkit.com> wrote:
>>>>>>>>>>
>>>>>>>>>> ...one other note.  I'm guessing calls to sqLite need drivers.
>>>>>>>>>>> These
>>>>>>>>>>>
>>>>>>>>>>> drivers are probably built in to Livecode and the OnRev server
>>>>>>>>>>>
>>>>>>>>>> which
>>>>>>>>>>
>>>>>>>>>> would
>>>>>>>>>
>>>>>>>> explain why LC's database commands works so well locally and with
>>>>>>>> the
>>>>>>>> OnRev
>>>>>>>> based samples.
>>>>>>>>
>>>>>>>> If this is the problem, does anybody know how I could install these
>>>>>>>>>
>>>>>>>>>> drivers on my own server?
>>>>>>>>>> On 4/5/2016 1:18 PM, Ray wrote:
>>>>>>>>>>
>>>>>>>>>> I've never worked with sqLite databases before but it appears I
>>>>>>>>>>>
>>>>>>>>>>>> should
>>>>>>>>>>>>
>>>>>>>>>>> be able to access one on a server pretty much the same as I do
>>>>>>>>>>
>>>>>>>>> locally.
>>>>>>>>
>>>>>>>> Here's what I've done:
>>>>>>>>>
>>>>>>>>>>        put revOpenDatabase("sqLite",localPath) into theDbId
>>>>>>>>>>>
>>>>>>>>>>>>        -- this creates a zero K local database file
>>>>>>>>>>>>
>>>>>>>>>>>        put "CREATE TABLE bugs(Name char(50), Date char(50))" into
>>>>>>>>>>
>>>>>>>>>> myQuery
>>>>>>>>>>>
>>>>>>>>>>>        revExecuteSQL theDbId,myQuery -- the local database file
>>>>>>>>>> is
>>>>>>>>>>
>>>>>>>>> no 2
>>>>>>>>
>>>>>>>> K
>>>>>>>>>
>>>>>>>>>>        revCloseDatabase theDbId -- close it or I won't be able to
>>>>>>>>>>
>>>>>>>>> copy
>>>>>>>>
>>>>>>>> it
>>>>>>>>>
>>>>>>>>>> to the server
>>>>>>>>>>
>>>>>>>>> I then copy the local database file to a remote server and make
>>>>>>>>> sure
>>>>>>>>>
>>>>>>>>>> all 9 permissions are checked (777).
>>>>>>>>>>>
>>>>>>>>>>> I now load the well-tested server path into the variable dbPath
>>>>>>>>>> and
>>>>>>>>>>
>>>>>>>>>> try this:
>>>>>>>>>>>
>>>>>>>>>>>        put revOpenDatabase("sqLite",dbPath) into myResult
>>>>>>>>>>
>>>>>>>>>> but all I get back is:
>>>>>>>>>>>
>>>>>>>>>>>>        Error: Unable to open the database file
>>>>>>>>>>>>
>>>>>>>>>>>> Suggestions?
>>>>>>>>>>>>
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>
>>>>>>>>>>> use-livecode mailing list
>>>>>>>>>>> use-livecode at lists.runrev.com
>>>>>>>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>>>>>>>>
>>>>>>>>>>> subscription preferences:
>>>>>>>>>>>
>>>>>>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>>>>>> Devin Asay
>>>>>>>>>> Office of Digital Humanities
>>>>>>>>>> Brigham Young University
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> use-livecode mailing list
>>>>>>>>>> use-livecode at lists.runrev.com
>>>>>>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>>>>>>>
>>>>>>>>>> subscription preferences:
>>>>>>>>>>
>>>>>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>>
>>>>>>>>> use-livecode mailing list
>>>>>>>>> use-livecode at lists.runrev.com
>>>>>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>>>>>> subscription preferences:
>>>>>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>>
>>>>>>>>> use-livecode mailing list
>>>>>>>> use-livecode at lists.runrev.com
>>>>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>>>>>
>>>>>>>> subscription preferences:
>>>>>>>>
>>>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>>
>>>>>>> use-livecode mailing list
>>>>>>> use-livecode at lists.runrev.com
>>>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>>>> subscription preferences:
>>>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>>
>>>>>>> use-livecode mailing list
>>>>>> use-livecode at lists.runrev.com
>>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>>> subscription preferences:
>>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>> use-livecode mailing list
>>>>> use-livecode at lists.runrev.com
>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>> subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>
>>>>> _______________________________________________
>>>>>
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list