Skip to content

Conversation

vshilin
Copy link
Contributor

@vshilin vshilin commented Aug 1, 2023

No description provided.

@vshilin vshilin requested a review from nconforti93 August 1, 2023 14:46
Copy link
Contributor

@allipatev allipatev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can look at suggestions, add "Background" and "Additional References" sections, and footer, as per "Tutorial" template, so that we could finally merge this one? :)

@vshilin vshilin requested a review from allipatev August 11, 2025 16:28
Copy link
Contributor

@allipatev allipatev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

I added a couple more cosmetic suggestions.

You can decide if you want to incorporate them, then merge.

Below are steps to connect to Exasol from Openresty.

* Install openresty [Openresty Installation manual](https://openresty.org/en/linux-packages.html#ubuntu)
* install Luarocks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* install Luarocks
* Install LuaRocks

sudo make install
```

* install ODBC package in luarocks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* install ODBC package in luarocks
* Install ODBC package in LuaRocks

Comment on lines +15 to +25
```shell
wget https://github.com/luarocks/luarocks/archive/v3.0.0.tar.gz

tar zxvf v3.0.0.tar.gz

./configure --prefix=/usr/local/openresty/luajit/ --with-lua=/usr/local/openresty/luajit/ --lua-suffix=jit --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1

sudo make build

sudo make install
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```shell
wget https://github.com/luarocks/luarocks/archive/v3.0.0.tar.gz
tar zxvf v3.0.0.tar.gz
./configure --prefix=/usr/local/openresty/luajit/ --with-lua=/usr/local/openresty/luajit/ --lua-suffix=jit --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1
sudo make build
sudo make install
```
```shell
wget https://github.com/luarocks/luarocks/archive/v3.0.0.tar.gz
tar zxvf v3.0.0.tar.gz
./configure --prefix=/usr/local/openresty/luajit/ --with-lua=/usr/local/openresty/luajit/ --lua-suffix=jit --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1
sudo make build
sudo make install
```

Comment on lines +29 to +31
```shell
luarocks install odbc
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```shell
luarocks install odbc
```
```shell
luarocks install odbc
```

Comment on lines +39 to +48
```shell
# set -x
# ORHOME is the path to the OpenResty install
export ORHOME="/usr/local/openresty"
export ODBCINI="${ORHOME}/odbc/.odbc.ini"
export LD_LIBRARY_PATH="${ORHOME}/luajit/lib"
export PATH="$PATH:${ORHOME}/bin/"
resty odbctest.lua $1
echo "Retun code from resty $?"
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```shell
# set -x
# ORHOME is the path to the OpenResty install
export ORHOME="/usr/local/openresty"
export ODBCINI="${ORHOME}/odbc/.odbc.ini"
export LD_LIBRARY_PATH="${ORHOME}/luajit/lib"
export PATH="$PATH:${ORHOME}/bin/"
resty odbctest.lua $1
echo "Retun code from resty $?"
```
```shell
# set -x
# ORHOME is the path to the OpenResty install
export ORHOME="/usr/local/openresty"
export ODBCINI="${ORHOME}/odbc/.odbc.ini"
export LD_LIBRARY_PATH="${ORHOME}/luajit/lib"
export PATH="$PATH:${ORHOME}/bin/"
resty odbctest.lua $1
echo "Retun code from resty $?"
```

Comment on lines +52 to +81
```lua
local odbc = require("odbc")
local call = [[select * from sys.exa_all_tables]]
print("Using dsn " .. arg[1])
local DSN = arg[1]
print("About to connect")
local cnn,err = odbc.connect(DSN)
if cnn == nil then
print("Failed to connect" .. err.message)
else
print("Connected")
end
local stmt,err = cnn:statement()
if stmt == nil then
print("Failed to prepare Statement" ..err.message)
else
print("Prepared statement" )
end
local ret,err = stmt:execute(call)
if ret == nil then
print("Failed to execute statement" .. err.message)
else
print("Executed satement")
end
local cols = ret:colnames()
if string.upper(cols[1]) == [[ERR]] then
-- There has been some sort of error
print("Some sort of error was raised " .. ret:fetch())
end
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```lua
local odbc = require("odbc")
local call = [[select * from sys.exa_all_tables]]
print("Using dsn " .. arg[1])
local DSN = arg[1]
print("About to connect")
local cnn,err = odbc.connect(DSN)
if cnn == nil then
print("Failed to connect" .. err.message)
else
print("Connected")
end
local stmt,err = cnn:statement()
if stmt == nil then
print("Failed to prepare Statement" ..err.message)
else
print("Prepared statement" )
end
local ret,err = stmt:execute(call)
if ret == nil then
print("Failed to execute statement" .. err.message)
else
print("Executed satement")
end
local cols = ret:colnames()
if string.upper(cols[1]) == [[ERR]] then
-- There has been some sort of error
print("Some sort of error was raised " .. ret:fetch())
end
```
```lua
local odbc = require("odbc")
local call = [[select * from sys.exa_all_tables]]
print("Using dsn " .. arg[1])
local DSN = arg[1]
print("About to connect")
local cnn,err = odbc.connect(DSN)
if cnn == nil then
print("Failed to connect" .. err.message)
else
print("Connected")
end
local stmt,err = cnn:statement()
if stmt == nil then
print("Failed to prepare Statement" ..err.message)
else
print("Prepared statement" )
end
local ret,err = stmt:execute(call)
if ret == nil then
print("Failed to execute statement" .. err.message)
else
print("Executed satement")
end
local cols = ret:colnames()
if string.upper(cols[1]) == [[ERR]] then
-- There has been some sort of error
print("Some sort of error was raised " .. ret:fetch())
end
```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants