We are migrating our python scripts to lua scripts as part of apache 2.4 upgrade. One of the requirement is connecting to Sybase database and execute queries. To do that we have developed a small code using mod_lua api to get db connection, but we haven't been successful.
We have installed the apr-util with freetds.
To get the database connection using mod_lua, mod_dbd and freetds - we followed the steps mentioned here - http://modlua.org/api/database#dbd
To configure the DPDParams for freetds, we followed the params mentioned here https://httpd.apache.org/docs/2.4/mod/mod_dbd.html#DBDParams
In VirtualHost of httpd.conf, we have added the following dbdparams
DBDriver freetds
DBDParams username=xxx,password=xxx,host=host-ip:port
DBDMax 10
and the lua code, just for getting a database connection is
require "apache2"
require "string"
function handle(r)
r.content_type = "text/html"
local database, err = r:dbacquire("mod_dbd")
r:err("inside handle method_1 " .. err)
return apache2.OK
end
The error we are getting in apache error log is-
[Thu Aug 25 15:28:03.198044 2016] [dbd:error] [pid 21708:tid 139621318366976] (20014)Internal error (specific information not available): AH00629: Can't connect to freetds:
[Thu Aug 25 15:28:03.198145 2016] [dbd:error] [pid 21708:tid 139621318366976] (20014)Internal error (specific information not available): AH00633: failed to initialise
[Thu Aug 25 15:28:03.198184 2016] [lua:error] [pid 21708:tid 139621318366976] [client 10.135.15.148:52836] inside handle method_1 Could not acquire connection from mod_dbd. If your database is running, this may indicate a permission problem.
We are able to connect to the database using tsql from the same system, but connection from apache dbd, is not working. We are suspecting that there might be some configuration(DBDParams) problems or that the OS may be blocking connection from apache
Could someone please help in this regard.