Iex-odbc build on Solaris 11.3

POST IN CONSTRUCTION
Process for compile erlang otp 20 with odbc-unix for Oracle connections on Solaris 11.3 for 64 bits:
Introduction ,this is a resume for get a elixir 1.5.1 whit Oracle odbc support on Solaris 11.3 .
0.- Precondition :

0.1.- A solaris version:

ale@switch:~$ uname -a
SunOS switch 5.11 11.3 i86pc i386 i86pc

0.2.- The releases:

otp_src_20.0.tar.gz unixODBC-2.3.4.tar.gz instantclient-basic-solaris.x64-12.2.0.1.0.zip instantclient-sqlplus-solaris.x64-12.2.0.1.0.zip instantclient-odbc-solaris.x64-12.2.0.1.0.zip

root user :

1 .- Environment and tools…

1.1.- Install gcc and tools:

# pkg install gcc
# pkg install developer/build/libtool
# pkg install developer-studio-utilities

1.2.- Install oracle client:

# cd /usr/local
# unzip instantclient-basic-solaris.x64-12.2.0.1.0.zip
# unzip instantclient-sqlplus-solaris.x64-12.2.0.1.0.zip
# unzip instantclient-odbc-solaris.x64-12.2.0.1.0.zip

1.3.- Configure oracle sqlplus connection:

# cd /usr/local/instantclient_12_2
# mkdir network
# cd network
# mkdir admin
# cd admin
# vi tnsnames.ora

XE=(DESCRIPTION=
_ (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))_
_ (CONNECT_DATA =_
_ (SERVER = DEDICATED)_
_ (SERVICE_NAME=xe)_
_ )_
)

/usr/local/instantclient_12_2# ls -ltr total 519324 -rwxrwxr-x 1 root root 390144 Jan 31 2017 uidrvci -rwxrwxr-x 1 root root 124773008 Jan 31 2017 libociei.so -rwxrwxr-x 1 root root 58096 Jan 31 2017 genezi -rw-rw-r-- 1 root root 331 Jan 31 2017 BASIC_README -rwxrwxr-x 1 root root 66776 Jan 31 2017 adrci -rwxrwxr-x 1 root root 142384 Jan 31 2017 liboramysql12.so -r-xr-xr-x 1 root root 348720 Jan 31 2017 libons.so -r-xr-xr-x 1 root root 14799968 Jan 31 2017 libnnz12.so -rwxrwxr-x 1 root root 1839216 Jan 31 2017 libocci.so.12.1 -r-xr-xr-x 1 root root 435888 Jan 31 2017 libmql1.so -r-xr-xr-x 1 root root 3632736 Jan 31 2017 libipc1.so -rwxrwxr-x 1 root root 11747904 Jan 31 2017 libclntshcore.so.12.1 -rwxrwxr-x 1 root root 93849584 Jan 31 2017 libclntsh.so.12.1 -rw-rw-r-- 1 root root 74230 Jan 31 2017 xstreams.jar -r--r--r-- 1 root root 4036257 Jan 31 2017 ojdbc8.jar -r-xr-xr-x 1 root root 183384 Jan 31 2017 libocijdbc12.so -rwxrwxr-x 1 root root 1756448 Jan 31 2017 libocci_stlport4.so.12.1 -rwxrwxr-x 1 root root 1625392 Jan 31 2017 libocci_cpp11.so.12.1 -r-xr-xr-x 1 root root 12192 Jan 31 2017 sqlplus -r-xr-xr-x 1 root root 1642848 Jan 31 2017 libsqlplusic.so -r-xr-xr-x 1 root root 2235168 Jan 31 2017 libsqlplus.so -r-xr-xr-x 1 root root 342 Jan 31 2017 glogin.sql -rw-rw-r-- 1 root root 335 Jan 31 2017 SQLPLUS_README -r-xr-xr-x 1 root root 4663 Jan 31 2017 odbc_update_ini.sh -r-xr-xr-x 1 root root 18742 Jan 31 2017 ODBC_IC_Readme_Unix.html -rwxrwxr-x 1 root root 891216 Jan 31 2017 libsqora.so.12.1 drwxrwxr-x 4 root root 4 Jan 31 2017 help drwxr-xr-x 3 root root 3 Sep 23 16:51 network
# chmod 755 ./*

1.4.- Disable native isql command :

# mv /usr/bin/isql /usr/bin/isql_back

2.- For compile unixODBC-2.3.4…

simple user:

$ export CFLAGS=-m64 $ export LD_LIBRARY_PATH=/usr/lib/amd64 $ mkdir /export/home/ale/programs/unixODBC-2.3.4/build64 $ ./configure --prefix=/export/home/ale/programs/unixODBC-2.3.4/build64 $ make $ make install

3.- For compile otp_src_20.0 …

$ export CFLAGS="-m64 -I/export/home/ale/programs/unixODBC-2.3.4/build64/include" $ export LD_LIBRARY_PATH=/usr/local/instantclient_12_2:/export/home/ale/programs/unixODBC-2.3.4/build64/lib $ ./configure --prefix=/export/home/ale/programs/otp_src_20.0/build --with-odbc=/export/home/ale/programs/unixODBC-2.3.4/build64/lib --without-ssl --enable-m64-build $ gmake $ gmake install

4.- Connection test SQLPLUS

$ export ORACLE_HOME=/usr/local/instantclient_12_2 $ export PATH=${PATH}:${ORACLE_HOME}:/export/home/ale/programs/unixODBC-2.3.4/build64/bin $ export ORACLE_SID=xe $ export LD_LIBRARY_PATH=/usr/local/instantclient_12_2:/export/home/ale/programs/unixODBC-2.3.4/build64/lib $ sqlplus SYC/lolalola@XE

SQL*Plus: Release 12.2.0.1.0 Production on Sat Sep 23 17:10:19 2017

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> select (1) from dual;
(1)


1
SQL> quit
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

5.- UNIX ODBC configuration …

$ cd /export/home/ale/programs/unixODBC-2.3.4/build/ $ vi etc/odbc.ini
[simple]
Driver = OracleODBC-12g
DSN = OracleODBC-12g
ServerName = xe
UserID = SYC
Password = lolalola
Server = 127.0.0.1
Port = 49161
SQLTranslateErrors = T

$ vi etc/odbcins.ini
[OracleODBC-12g]
Description = Oracle ODBC driver for Oracle 12g
Driver = /usr/local/instantclient_12_2/libsqora.so
FileUsage = 1
Driver Logging = 7

Connection test ISQL
$ isql -v simple

±--------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
±--------------------------------------+
SQL> select (1) from dual;
±----------------------------------------+
| (1) |
±----------------------------------------+
| 1 |
±----------------------------------------+
SQLRowCount returns -1
1 rows fetched

6.- Connection test ERL

ale@switch:~/programs/otp_src_20.0/build$ bin/erl

Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V9.0 (abort with ^G)
>odbc:start().
ok
21> {ok, Ref} = odbc:connect(“DSN=simple”, [{scrollable_cursors, off}]).
{ok,<0.112.0>}
22> odbc:sql_query(Ref, “select (1) from dual”)
22> .
{selected,[“(1)”],[{1.0}]}
[/quote]

7.- Connection test IEX

" I downloaded Precompiled.zip 1.5.1 release"

ale@switch:~/programs/elixir-1.5.1_precompiled$ bin/iex

Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]
Interactive Elixir (1.5.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :odbc.start
:ok
iex(3)> {ok, ref } = :odbc.connect(‘DSN=simple’, [ scrollable_cursors: :off])
{:ok, #PID<0.94.0>}
iex(4)> :odbc.sql_query(ref, ‘select (1) from dual’)
{:selected, [‘(1)’], [{1.0}]}
iex(5)>

Thats it, I wish it to help you .

1 Like

Can you please use some markdown to do better formatting, also an introductionary sentence would be nice. Currently it reads like a strait dump of your shellsession.

2 Likes

NobbZ thanks for the reply, I am working on it .

1 Like