Skip to Content
0
Nov 21, 2020 at 04:03 AM

unixODBC and native ODBC driver

766 Views

Hi, ALL,

I'm sorry for this very long post, but I need to explain what I did in details:

1. I downloaded and successfull installed SAP ASE 16.0 on my Gentoo Linux box.

2. Then I opened the editor and diid this:

[code]

igor@IgorReinCloud ~ $ cat /etc/unixODBC/odbcinst.ini

[ODBC]
Trace=yes
TraceFile=/tmp/sql.log

[Sybase]
Description=Native Sybase Driver
Driver=/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so
#Driver=/opt/sap/DBISQL-16_0/bin/libdbodbc16_r.so
#Driver=/opt/sap/DataAccess/ODBC/lib/libsybdrvodb.so
FileUsage=1

[Postgres]
Description=Postgres ODBC Driver
Driver=/usr/lib64/psqlodbcw.so
FileUsage=1

igor@IgorReinCloud ~ $ cat /etc/unixODBC/odbc.ini
[Sybase16]
Driver=Sybase
Description=Sybase 16 Native Driver
Trace=Yes
Server=REINCLOUD
Database=draft
TraceLog=/tmp/sql.log
Port=5000
UserID=sa

[postgres]
Driver=Postgres
Description=Postgres ODBC Driver
UserId=postgres
Password=wasqra
Servername=192.168.1.209
Database=draft

3. Then I tried to connect with issuing:

isql Sybase16 sa <password>

and I got a message "Could not SQLConnect".

4. Next I tried to get more information about the reason why I can't connect. So I ran my program, which uses

SQLGetDiagRec().

This call returned an error of "Invalid port number".

Googling revealed that this is an indication of the wrong driver being loaded.

5. So I tried to change the driver to be 32-bit (switching the lines in the odbcinst.ini) and tried to connect again.

I still receive "Could not SQLConnect".

6. I looked at the ODBC log file and I see following:

[quote]

[ODBC][26378][1605928820.476380][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLConnect.c][3751]
Entry:
Connection = 0x5569590e5b90
Server Name = [Sybase16][length = 8 (SQL_NTS)]
User Name = [sa][length = 2 (SQL_NTS)]
Authentication = [******][length = 6 (SQL_NTS)]
UNICODE Using encoding ASCII 'UTF8' and UNICODE 'UTF16LE'

[ODBC][26378][1605928820.479112][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLConnect.c][1138]Can't open lib '/opt/sap/DataAccess/ODBC/lib/libsybdrvodb.so' : file not found

[/quote]

7. So I did a verification:

[code]

igor@IgorReinCloud ~ $ ls -la /opt/sap/DataAccess/ODBC/lib/
total 8388
drwxrwxr-x 3 root root 4096 Nov 15 17:46 .
drwxrwxr-x 6 root root 4096 Nov 15 17:46 ..
-rwxr-xr-x 1 root root 4691399 Aug 28 2017 libsapcrypto.so
-rwxr-xr-x 1 root root 416329 Aug 28 2017 libslcryptokernel.so
-rwxr-xr-x 1 root root 166 Aug 28 2017 libslcryptokernel.so.sha256
-rwxr-xr-x 1 root root 3459940 Aug 28 2017 libsybdrvodb.so
drwxrwxr-x 5 root root 4096 Nov 15 17:46 locales

igor@IgorReinCloud ~ $ ls -la /opt/sap/DataAccess64/ODBC/lib/
total 16596
drwxrwxr-x 3 root root 4096 Nov 15 17:46 .
drwxrwxr-x 7 root root 4096 Nov 15 17:46 ..
-rwxr-xr-x 1 root root 5767862 Aug 27 2017 libsapcrypto.so
-rwxr-xr-x 1 root root 499679 Aug 27 2017 libslcryptokernel.so
-rwxr-xr-x 1 root root 166 Aug 27 2017 libslcryptokernel.so.sha256
lrwxrwxrwx 1 root root 25 Nov 15 17:46 libsybdrvodb.so -> ./libsybdrvodb-sqllen4.so
-rwxr-xr-x 1 root root 3633987 Aug 26 2017 libsybdrvodb-sqllen4.so
-rwxr-xr-x 1 root root 3434443 Aug 28 2017 libsybdrvodb-sqllen4.so.fbo
-rwxr-xr-x 1 root root 3630914 Aug 27 2017 libsybdrvodb-sqllen8.so
drwxrwxr-x 5 root root 4096 Nov 15 17:46 locales

[/code]

Now, my question is:

What am I missing?

My application is 32-bit (compiled without -m64) and unixODBC packet I think is 64-bit.

The OS itself is also 64-bit:

[code]

igor@IgorReinCloud ~ $ uname -a
Linux IgorReinCloud 4.14.65-gentoo #6 SMP Sun Aug 30 02:41:41 CDT 2020 x86_64 AMD E-350 Processor AuthenticAMD GNU/Linux
igor@IgorReinCloud ~ $

[/code]

Thank you for any suggestions you guys can provide.