'Lua: Connect with MSSQL DB

I'm learning about Lua (version 5.3),Is there a way to connect to an mssql database? I try to do it as follows

print("Connection to the db:")
local dbuser = '....'
local dbpass = '...'
local dbsource = '....'
local dbname = 'xx.xx.xxx.xx'
database.open("Provider= ODBC ; Initial Catalog = dbname; Data Source = dbsource ; User ID = dbuser ; Password = dbpass ")
print("Database opened succesfully.")
print("Connection to the db:")

But didn´t work, execution returns me:

 attempt to index a nil value (global 'database')

Thanks,



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source