Thanks for your response!sturgis wrote: ↑Fri Feb 22, 2019 2:05 amIf the default folder is pointing to the location that contains your "data" folder, I think it should locate and open up your database correctly. If this is happening in the IDE, its likely that the default folder is pointing to a wrong, and likely un-writeable location. Check to see what the default folder is set to. If its correct, you can check to see if: there is a file "data/database.sqlite" If both of these check out, you likely don't have permission to write directly to the folder in question. (what os, and where is the file? ) Depending on the OS, it might be necessary to copy the file to a better location for use. My guess is a permissions issue with the location because if you have permission in LC to open a file, it would have created it with no error rather than telling you it couldn't do it.
chuckm wrote: ↑Thu Feb 21, 2019 9:57 pmSo, I just added the following code to the first card per the openStack Api in the docs:
I got the following message in an answer box:Code: Select all
on openStack global gConId put revOpenDatabase("sqlite", "data/database.sqlite") into tConId if tConId is "" then answer warning "Problem creating or accessing database!" else answer information "Database connected. Your connection id is: " & tConId put tConId into gConId end if end openStack on closeStackRequest revCloseDatabase gConId end closeStackRequest
Database connected. Your connection id is: Database Error: Unable to open the database file.
So obviously something is rotten in the state of Denmark. The database exists, and to the best of my knowledge is valid because I can query it from the command line as well as from several different GUI tools. There's no password, so I'm wondering if the database has to be in the same directory as the LiveCode app. This is a great example of posted code in the forums, StackOverflow, etc. that fails to work although it may largely be due to my lack of understanding. All I'm trying to do to start is just open the database and yet the code fails and to be honest, the error message is worthless. I'll apologize in advance if the comment comes across as offensive because it is not meant to be so, but I speak plainly.
It turns out that I needed to use a backslash instead of a forward slash in the relative path. I work under Unix (MacOS, Linux) a lot more than I do Windows so it didn't occur to me that the path delimiter would be the issue. I actually found it by trial and error before I found anything from searching the web. Not a great use of my time, but I noted it in my dev journal for future reference.
Best regards,
Chuck