spv4fa
Last Updated: February 25, 2016
·
473
· ejstembler
07a1c91639f297f3dbe8cb82f87ac961

Connect to Netezza via ODBC in Lua

https://gist.github.com/4420315

-- 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()
Say Thanks
Respond