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()
Written by Edward J. Stembler
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Lua
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#