<div dir="ltr"><div>Hi!</div><div>I am new to LuaTeX and LuaLaTeX, please, bear with my ignorance of some probably basic things. :-) I need to get strings from MySQL database and the test Lua code that does it works fine when it is called from the command line:</div><div><br></div><div>require("string")<br>function projects_from_db ()<br>    DBI = require("DBI")<br>    dbh = assert(DBI.Connect('MySQL','serge', 'serge', 'serge', 'localhost', 3306))<br>    sth = assert(dbh:prepare('SELECT name,budget FROM projects'))<br>    sth:execute()<br>    for row in sth:rows() do<br>        print(string.format("%-55s & %7.1f \\\\",row[1],row[2]))<br>    end<br>    dbh:close()<br>end<br><br>-- projects_from_db()</div><div><br></div><div>However, when I put it into latex file</div><div><br></div><div>\usepackage{luacode}<br>\usepackage{luapackageloader}<br>\directlua{dofile('dbd.lua')}</div><div>\newcommand{\projectsfromdb}{\luadirect{projects_from_db()}}</div><div><br></div><div>It says that MySQL driver can not be found:</div>./DBI.lua:53: Cannot load driver MySQL. Available drivers are: (None)<br>stack traceback:<br>       [C]: in function 'error'<br>       ./DBI.lua:53: in function 'DBI.Connect'<br>       dbd.lua:6: in function 'projects_from_db'<br>       [\directlua]:1: in main chunk.<br>\luadirect ... { \luacode@maybe@printdbg {#1} #1 }<br>                                                  <br>l.64    \projectsfromdb<div><br></div><div>Why is that? I checked package.cpath from Lua and the necessary path is there:</div><div><br></div><div>Lua 5.3.6  Copyright (C) 1994-2020 Lua.org, PUC-Rio<br>> package.cpath<br>/usr/lib64/lua/5.3/?.so;/usr/lib64/lua/5.3/loadall.so;./?.so</div><div><br></div><div>I tried to set a few environment variables:</div><div><br></div><div>LUAROCKS_CPATH=/usr/lib64/lua/5.3<br>LUAROCKS_PATH=/usr/share/lua/5.3</div><div><br></div><div>but it did not make any difference<span style="font-family:monospace"><br></span><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Thanks,<br>Sergei<br></div></div></div>