View Full Version : use of luacom not possible from within webserver pages ?

March 18th, 2012, 03:26 PM

I try to connect to a database from witihin an .lhtlm page.

I use this lua function wich works in a lua script in Girder GUI but not from the lhtml page :
local cn = luacom.CreateObject("ADODB.Connection")

when I include the database.lua file in my script it failed on line 12 :

The function that set this variable is
dblua_data.connection = luacom.CreateObject("ADODB.Connection")

Why does it not works from a webserver script ?

Thanks for help

March 18th, 2012, 03:35 PM
I would not do com inside a webpage. There are threading issues related to com. Probably better to do the database access using LuaSQL which has a ODBC driver.

March 18th, 2012, 04:18 PM
Thank you Ron.
I succesfully connect to my database thru ODBC with LuaSQL.

Does luasql.mysql() is supported ? It seems not.

attempt to call field `mysql' (a nil value) stack traceback: [string "WebServer"]:31: in main chunk

But luasql.odbc() is working ...

March 18th, 2012, 04:24 PM
yeah I don't think we have a mysql driver currently for LuaSQL. At least you can get to your data through ODBC!

March 18th, 2012, 07:09 PM
SQLite works well too....