Run lua database.query command from secondary hub nas probe
search cancel

Run lua database.query command from secondary hub nas probe


Article ID: 263023


Updated On:


DX Unified Infrastructure Management (Nimsoft / UIM)


I am considering creating a scheduled lua script to run from the nas probes on our secondary hubs which would require a query of the UIM database.

For initial testing, I ran the following from the nas script editor on a secondary hub (this works from the primary hub):"provider=nis;database=CA_UIM;driver=none")

Error: unable to open the database.

I assume this is because secondary hubs cannot run queries of the UIM database. 

Is it possible to run the database.<command> commands from nas lua scripts on secondary hubs?  If so, what would be required to do so?


Release: any


The way this works when using "provider=nis" is that it creates a connection string based on the information already available to NAS via the NiS Bridge.  So this does only work on the primary hub since you cannot have NiS Bridge enabled elsewhere.

There is a workaround but it's not terribly secure as you would have to put the username and password for the DB server into a script, e.g.:


local dbuser = 'user'
local dbpass = 'password'
local dbserver = ''
local dbname = 'CA_UIM'

 local mydb = "Provider=SQLOLEDB;Initial Catalog="..dbname..";Data Source="..dbserver..";User ID="..dbuser..";Password="..dbpass..";Network Library=dbmssocn;Language=us_english"


So it is technically possible - but as mentioned this may violate security best practices.  Please ensure you are following your organization's security policies.