Page 1 of 1

Livecodescript and MySQL

Posted: Thu Jul 17, 2025 4:29 pm
by MaxV
I'm trying to use a pure livecode script (file.livecodescript) to access to a MySQL database, but it doesn't work outside the Livecode IDE.

I launch the the script this way:

Code: Select all

/opt/livecode/livecode.x86_64  -ui  /home/max/file.livecodescript
and I get error the line with revOpenDatabase function. Probably the script can't reach the database drivers.

How can I solve this? Where I should put the database drivers? I tried in many places without success.

Re: Livecodescript and MySQL

Posted: Thu Jul 17, 2025 5:36 pm
by stam
MaxV wrote:
Thu Jul 17, 2025 4:29 pm
I'm trying to use a pure livecode script (file.livecodescript) to access to a MySQL database, but it doesn't work outside the Livecode IDE.

I launch the the script this way:

Code: Select all

/opt/livecode/livecode.x86_64  -ui  /home/max/file.livecodescript
and I get error the line with revOpenDatabase function. Probably the script can't reach the database drivers.

How can I solve this? Where I should put the database drivers? I tried in many places without success.
Probably worth mentioning what OS (linux?) and what LC version?

Not sure it's a driver issue.
If it runs in the IDE (I presume you as a GUI stack), then attempting to run the IDE as console app may be the issue, or at least that's I what I rightly or wrongly understood from your code.

An app may need to be built and run as console app with the "-ui" flag, and when building you'd include the db driver as per normal and just have the app load your scriptOnlyStack as a library.
Although I may just be making stuff up...

Another way to run livecode script from the command line would be with livecode server, which includes the DB drivers, and does work although you'd probably need to modify your text file to encapsulate LC code with "<?lc" and "?>" tags.

Code: Select all

$ livecode-server myscript.lc
That seems like a better way to run a stack directly from the command line, but again, I may just be making stuff up...