Connect to Netezza via ODBC from Lua
Software Engineering
1928 views
How to connect to Netezza via ODBC using Lua:
-- Connect to Netezza via ODBC from Lua
-- load driver
require "luasql.odbc"
-- create environment object
env = assert(luasql.odbc())
-- connect to data source using an existing DSN
-- assumes username/password are defined with DSN
con = assert(env:connect("NZSQL"))
query = "select count(*) from mytable"
cur = assert(con:execute(query))
count = cur:fetch()
print(string.format("count: %d", count))
-- close everything
cur:close()
con:close()
env:close()