Using MySQL on (headless) Linux
devin_asay at byu.edu
Mon Feb 1 16:48:03 EST 2021
I have seen the “invalid database type” error on Linux because of a case error. Make sure you use “mysql” as the database type, not “MySQL” or anything else with upper case letters. LiveCode is not case-sensitive, but Linux is.
Hope this helps.
> On Feb 1, 2021, at 2:32 PM, Ben Rubinstein via use-livecode <use-livecode at lists.runrev.com> wrote:
> Update. I have managed to get access to the Rev database external by explicitly setting the `externals` property of the stack before saving it (on Mac) to the full path on the linux machine to `revdb.so`.
> Consequently the functions such as `revOpenDatabases` and `revOpenDatabase` no longer throw error 219. Hurrah. Indeed `externalCommands` and `externalFunctions` now list all the expected commands and functions of the database library.
> This is obviously an appalling solution, since it relies on me knowing the exact path to the LiveCode bundle on the destination machine. (My recollection from a decade or so ago is that this property has to already be set at the time that the stack is opened, i.e. it can't be set dynamically. This may be erroneous.) However, it will get me going for now.
> Now my issue is that when the code tries to open the database, `revOpenDatabase` returns "revdberr,invalid database type". That suggests that the drivers aren't found.
> I've tried to get past this using `revSetDatabaseDriverPath`.
> The documentation says
>> Use the revSetDatabaseDriverPath command if you want to place the database
>> drivers your application uses somewhere other than the same folder as the
> In fact the drivers are in the standard location, so this shouldn't be needed, but hey... I started by reporting `revGetDatabaseDriverPath` - but calling that causes LiveCode to immediately exit on signal 11. (This was in a try-catch block, but that doesn't stop it crashing out.)
> However, after using `revSetDatabaseDriverPath`, `revGetDatabaseDriverPath` no longer crashes but faithfully reports the value set.
> Unfortunately, this doesn't seem to help - although "set the defaultFolder to revGetDatabaseDriverPath()/put the files" does list the folder which includes dbmysql.so - revOpenDatabase still returns "revdberr,invalid database type".
> Any suggestions gratefully received!
> On 01/02/2021 20:24, Ben Rubinstein via use-livecode wrote:
>> Hi Mark,
>> > "error in function handler" is a pretty generic response - sort of the
>> > engine's version of ¯\_(ツ)_/¯. Is the MySQL database local to the server
>> > machine or on a different computer?
>> I should point out that this error is thrown - I take it to mean that the function isn't even located. I don't think the problem is with the details of the database connection, I don't think it gets that far.
>> To test this, I've added a call to revOpenDatabases before doing anything else - sure enough, this throws the same error.
>> > Does this work locally before moving the
>> > stack to the headless linux box?
>> The whole shebang works on my Mac. I tried to see if I could run LiveCode headless on Mac, to minimise the differences that might be at issue, and got
>> Startup error - cannot run in command line mode
>> I don't know if that's a generic issue that LiveCode can't run headless on Mac, or if there's something else going on there.
>> On 01/02/2021 19:37, Mark Wieder via use-livecode wrote:
>>> On 2/1/21 11:15 AM, Ben Rubinstein via use-livecode wrote:
>>>> With thanks to friends here who helped me install and start using LC on a headless Linux box. I've now another little problem... my stack tries and fails to connect to a MySQL database.
>>>> When it attempts to call revOpenDatabase, it throws error 219, "error in function handler". I take it that this means it can't find or hasn't loaded the revdb external.
>>>> I've installed livecodecommunity-9.6.1.x86_64, and I launch it with
>>>> ~/.runrev/components/livecodecommunity-9.6.1.x86_64/LiveCode\ Community.x86_64 -ui <mystack.livecode>
>>>> I can see revdb.so and dbmysql.so are in the Externals directory. Is there something explicit I need to do to load these?
>>> "error in function handler" is a pretty generic response - sort of the engine's version of ¯\_(ツ)_/¯. Is the MySQL database local to the server machine or on a different computer? Does this work locally before moving the stack to the headless linux box?
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
Office of Digital Humanities
Brigham Young University
More information about the use-livecode