Hi, I'm trying to get MySQL data access working but can't solve the issues I'm encountering. Part of my code looks like: \startluacode productsheet = productsheet or {} function productsheet.sqldatabase(database,user,password) productsheet:sql(database,user,password) end function productsheet:sql(db,us,pw) print("SQLDATABASE: database: " .. db) print("SQLDATABASE: username: " .. us) print("SQLDATABASE: password: " .. pw) local sql = require("util-sql") local presets = {database = db,username = us,password = pw,host= "localhost",port= 3306} local template = [[SELECT `nom`, `name_alias` FROM `llx_societe` WHERE `nom` = '%nom%' ;]] presets.id = "mysql" local data, keys = utilities.sql.execute {presets=presets,template=template,variables={nom = "Life"}} ... This generates the following issues: sql > start loading method 'library' lua error > lua error on line 153 in file /home/gverhaag/Stock/ProductSheet/productsheet_KG594.tex: /usr/share/texmf/tex/context/base/mkiv/l-sandbox.lua:180: module 'luasql.mysql' not found: no field package.preload['luasql.mysql'] no file '/usr/local/share/lua/5.2/luasql/mysql.lua' no file '/usr/local/share/lua/5.2/luasql/mysql/init.lua' no file '/usr/local/lib/lua/5.2/luasql/mysql.lua' no file '/usr/local/lib/lua/5.2/luasql/mysql/init.lua' no file './luasql/mysql.lua' no file '/usr/local/lib/lua/5.2/luasql/mysql.so' no file '/usr/local/lib/lua/5.2/loadall.so' no file './luasql/mysql.so' no file '/usr/local/lib/lua/5.2/luasql.so' no file '/usr/local/lib/lua/5.2/loadall.so' no file './luasql.so' stack traceback: [C]: in function 'requiem' /usr/share/texmf/tex/context/base/mkiv/l-sandbox.lua:180: in function (...tail calls...) ...are/texmf/tex/context/base/mkiv/util-sql-imp-library.lua:74: in main chunk [C]: in function 'requiem' /usr/share/texmf/tex/context/base/mkiv/l-sandbox.lua:180: in function (...tail calls...) /usr/share/texmf/tex/context/base/mkiv/util-sql.lua:114: in function '__index' /usr/share/texmf/tex/context/base/mkiv/util-sql.lua:288: in function 'execute' [ctxlua]:21: in function 'sql' [ctxlua]:5: in function 'sqldatabase' [ctxlua]:1: in main chunk Must be something basic, I guess! I use the TexLive 2017 version of ConTeXt. Any idea what I'm doing wrong here?
On 6/3/2021 12:51 PM, Gerard Verhaag wrote:
Hi,
I'm trying to get MySQL data access working but can't solve the issues I'm encountering. Part of my code looks like: it's probably better to use
\usemodule[sql] you also need to have the sql library in the tex binary tree (see manual) (in luatex/mkiv it's best to use the ffi variant that interfaces to the mysql library; in luametatex/lmtx it's a - by default - build in optional which loads the lib on demand; in all cases most happens in lua) so, if it doesn't work, you have to explain your setup Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Hans, thanks for your answer. I also tried \usemodule[sql] with the same result however! The system I use is Ubuntu 18.01 and installed TeXStudio, that's all. That also installs TeX/LaTeX/ConTeXt, but probably that's causing the issues! Hopefully a complete reinstall of TeXLive will solve the issue. Regards, Gerard On 03-06-2021 20:43, Hans Hagen wrote:
On 6/3/2021 12:51 PM, Gerard Verhaag wrote:
Hi,
I'm trying to get MySQL data access working but can't solve the issues I'm encountering. Part of my code looks like: it's probably better to use
\usemodule[sql]
you also need to have the sql library in the tex binary tree
(see manual)
(in luatex/mkiv it's best to use the ffi variant that interfaces to the mysql library; in luametatex/lmtx it's a - by default - build in optional which loads the lib on demand; in all cases most happens in lua)
so, if it doesn't work, you have to explain your setup
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- --
Sender:G.C.H.M. Verhaag St. Jorisstraat 29 5954 AN Beesel NETHERLANDS Tel.: +31-(0)619502702, E-mail: verhaaggchm@ziggo.nl Ik vertrouw erop dat de persoonlijke gegevens, te vinden in deze mail, uitsluitend voor correspondentie met ondergetekende worden gebruikt en beslist niet voor reclamedoeleinden of welke andere wijze dan ook. Het opnemen van deze gegevens, in welk soort van opslagsysteem dan ook, evenals het doorgeven ervan aan derden, zie ik als een schending van mijn privacy.
On 6/4/2021 9:09 PM, G.C.H.M. Verhaag wrote:
Hans, thanks for your answer. I also tried \usemodule[sql] with the same result however!
The system I use is Ubuntu 18.01 and installed TeXStudio, that's all.
That also installs TeX/LaTeX/ConTeXt, but probably that's causing the issues!
Hopefully a complete reinstall of TeXLive will solve the issue. otherwise try a minimal install (mkiv or lmtx) from the garden
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
G.C.H.M. Verhaag
-
Gerard Verhaag
-
Hans Hagen