cancel
Showing results for 
Search instead for 
Did you mean: 

unixODBC and native ODBC driver

oneeyeman1
Participant
0 Kudos

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.

Accepted Solutions (0)

Answers (14)

Answers (14)

oneeyeman1
Participant
0 Kudos

ryan.hansen ,

I only see 2.

And I also think that unixODBC by default does not using system odbc.ini (System DSN in Windows). Because it creates a User odbc.ini file with the "User DSN" set. At least this is the case on my machine/distro.

I will ask on the Gentoo forum (and possibly to unixODBC maintainers).

In the meantime I will try to make UserDSN and use it with my program.

Thank you.

ryan_hansen
Employee
Employee
0 Kudos

Hi,

I see that you have multiple files available to be picked up.

As the error message suggests that the odbc.ini doesn't include a port number than there is a possibility that multiple files are being used.

Your output shows 3 locations.

I would use the environment variables and a unique name so that it cant possibly pick up another entry.

Regards,
Ryan

oneeyeman1
Participant
0 Kudos

@Ryan Hansen,

I believe I am using the proper configuration:


[code]

igor@IgorReinCloud ~/dbhandler/Debug/dbhandler $ grep "odbc.ini" output.log
12460 01:11:08 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_WRONLY|O_CREAT|O_APPEND, 0666) = 11
12460 01:11:08 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_RDONLY) = 11
12460 01:11:08 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:08 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:08 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_WRONLY|O_CREAT|O_APPEND, 0666) = 11
12460 01:11:08 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_RDONLY) = 11
12460 01:11:08 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:08 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:08 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_WRONLY|O_CREAT|O_APPEND, 0666) = 11
12460 01:11:08 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_RDONLY) = 11
12460 01:11:08 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:08 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:20 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_WRONLY|O_CREAT|O_APPEND, 0666) = 11
12460 01:11:20 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_RDONLY) = 11
12460 01:11:20 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:20 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:20 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_WRONLY|O_CREAT|O_APPEND, 0666) = 11
12460 01:11:20 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_RDONLY) = 11
12460 01:11:20 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:20 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_WRONLY|O_CREAT|O_APPEND, 0666) = 11
12460 01:11:28 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_WRONLY|O_CREAT|O_APPEND, 0666) = 11
12460 01:11:28 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_WRONLY|O_CREAT|O_APPEND, 0666) = 11
12460 01:11:28 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_WRONLY|O_CREAT|O_APPEND, 0666) = 11
12460 01:11:28 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_WRONLY|O_CREAT|O_APPEND, 0666) = 11
12460 01:11:28 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_WRONLY|O_CREAT|O_APPEND, 0666) = 11
12460 01:11:28 openat(AT_FDCWD, "/home/igor/.odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
12460 01:11:28 openat(AT_FDCWD, "/etc/unixODBC/odbc.ini", O_RDONLY) = 11
igor@IgorReinCloud ~/dbhandler/Debug/dbhandler $

[/code]

I can try to post the full output log from running my program if needed.

Thank you.

oneeyeman1
Participant
0 Kudos

ryan.hansen ,

I commented out everything Postgres-related, but it still errors out:

[code]

[ODBC][15562][1610132043.185921][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x55ef21580ad0
[ODBC][15562][1610132043.186030][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][189]
Entry:
Environment = 0x55ef21580ad0
Attribute = SQL_ATTR_ODBC_VERSION
Value = 0x3
StrLen = 0
[ODBC][15562][1610132043.186070][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][381]
Exit:[SQL_SUCCESS]
[ODBC][15562][1610132043.186110][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x55ef21580ad0
[ODBC][15562][1610132043.187756][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][15562][1610132043.187878][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x55ef21580ad0
[ODBC][15562][1610132043.188111][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][15562][1610132043.188169][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][220]
Entry:
Handle Type = 1
Input Handle = 0x55ef21580ad0
[ODBC][15562][1610132059.317957][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x55ef21667a00
[ODBC][15562][1610132059.318054][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][189]
Entry:
Environment = 0x55ef21667a00
Attribute = SQL_ATTR_ODBC_VERSION
Value = 0x3
StrLen = -6
[ODBC][15562][1610132059.318094][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][381]
Exit:[SQL_SUCCESS]
[ODBC][15562][1610132059.318133][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLAllocHandle.c][377]
Entry:
Handle Type = 2
Input Handle = 0x55ef21667a00
[ODBC][15562][1610132059.318176][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLAllocHandle.c][493]
Exit:[SQL_SUCCESS]
Output Handle = 0x55ef21482200
[ODBC][15562][1610132059.318217][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x55ef21667a00
[ODBC][15562][1610132059.318498][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][15562][1610132059.318540][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x55ef21667a00
[ODBC][15562][1610132059.318766][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][15562][1610132059.318826][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetConnectAttrW.c][332]
Entry:
Connection = 0x55ef21482200
Attribute = SQL_ATTR_LOGIN_TIMEOUT
Value = 0x5
StrLen = 0
[ODBC][15562][1610132059.318866][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetConnectAttrW.c][623]
Exit:[SQL_SUCCESS]
[ODBC][15562][1610132059.318911][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDriverConnectW.c][290]
Entry:
Connection = 0x55ef21482200
Window Hdl = 0x55ef214ae260
Str In = [DSN=Sybase16;sa;wasqra;Driver=Sybase;UID=sa;PWD=wasqra][length = 54 (SQL_NTS)]
Str Out = 0x55ef213d7b30
Str Out Max = 1024
Str Out Ptr = 0x7fffcb599e18
Completion = 0
UNICODE Using encoding ASCII 'UTF8' and UNICODE 'UTF16LE'

[ODBC][15562][1610132059.349963][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDriverConnectW.c][699]
Exit:[SQL_ERROR]
[ODBC][15562][1610132059.350102][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x55ef21482200
Rec Number = 1
SQLState = 0x7fffcb599990
Native = 0x7fffcb599944
Message Text = 0x7fffcb5999c0
Buffer Length = 1024
Text Len Ptr = 0x7fffcb59993c
[ODBC][15562][1610132059.350357][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_SUCCESS]
SQLState = [01S00]
Native = 0x7fffcb599944 -> 30011
Message Text = [[SAP][ASE ODBC Driver]Invalid port number]
[ODBC][15562][1610132059.350451][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x55ef21482200
Rec Number = 2
SQLState = 0x7fffcb599990
Native = 0x7fffcb599944
Message Text = 0x7fffcb5999c0
Buffer Length = 1024
Text Len Ptr = 0x7fffcb59993c
[ODBC][15562][1610132059.350493][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_NO_DATA]
[ODBC][15562][1610132065.415244][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetConnectAttrW.c][236]
Entry:
Connection = 0x55ef21482200
Attribute = 1209
Value = 0x7fffcb59c358
Buffer Length = 0
StrLen = 0x7fffcb59c350
[ODBC][15562][1610132065.415386][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetConnectAttrW.c][325]Error: 08003
[ODBC][15562][1610132065.415456][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x55ef21482200
Rec Number = 1
SQLState = 0x7fffcb59bed0
Native = 0x7fffcb59be84
Message Text = 0x7fffcb59bf00
Buffer Length = 1024
Text Len Ptr = 0x7fffcb59be7c
[ODBC][15562][1610132065.415520][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_SUCCESS]
SQLState = [08003]
Native = 0x7fffcb59be84 -> 0
Message Text = [[unixODBC][Driver Manager]Connection not open]
[ODBC][15562][1610132065.415584][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x55ef21482200
Rec Number = 2
SQLState = 0x7fffcb59bed0
Native = 0x7fffcb59be84
Message Text = 0x7fffcb59bf00
Buffer Length = 1024
Text Len Ptr = 0x7fffcb59be7c
[ODBC][15562][1610132065.415694][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_NO_DATA]
[ODBC][15562][1610132065.415744][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][290]
Entry:
Handle Type = 2
Input Handle = 0x55ef21482200
[ODBC][15562][1610132065.415792][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][339]
Exit:[SQL_SUCCESS]
[ODBC][15562][1610132065.415836][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][220]
Entry:
Handle Type = 1
Input Handle = 0x55ef21667a00

[/code]

Server is running:

[code]

igor@IgorReinCloud ~ $ ps aux | grep sap
root 3423 0.8 18.2 5842060 1441340 ? Ssl 2020 150:19 /opt/sap/ASE-16_0/bin/dataserver -d/opt/sap/data/master.dat -e/opt/sap/ASE-16_0/install/REINCLOUD.log -c/opt/sap/ASE-16_0/REINCLOUD.cfg -M/opt/sap/ASE-16_0 -N/opt/sap/ASE-16_0/sysam/REINCLOUD.properties -i/opt/sap -sREINCLOUD -psa
root 3708 0.0 0.1 516072 8236 ? Ssl 2020 0:46 /opt/sap/ASE-16_0/bin/jsagent -p 4900 -n localhost -t 32 -l 0 -v -e /opt/sap/ASE-16_0/install/REINCLOUD_JSAGENT.log -i /opt/sap > /dev/null
igor 16667 0.0 0.0 12980 2532 pts/2 S+ 12:57 0:00 grep --colour=auto sap
igor 27679 0.3 1.9 2850300 156828 pts/1 Sl+ 02:47 1:51 /opt/sap/shared/SAPJRE-7_1_049_64BIT/bin/java -Disql.repositoryDirectory=/opt/sap/DBISQL-16_0/bin -Djava.security.policy=/opt/sap/DBISQL-16_0/lib/java.policy -Xmx1000m -Dsybase.native.executable=/opt/sap/DBISQL-16_0/bin/dbisql -Dasa.dblib_directory=/opt/sap/DBISQL-16_0/bin/../lib64 -Dsun.java2d.noddraw=true -Dsun.java2d.d3d=false -cp /opt/sap/DBISQL-16_0/lib/isql.jar:/opt/sap/DBISQL-16_0/lib/jlogon.jar:/opt/sap/DBISQL-16_0/lib/SCEditor1600.jar:/opt/sap/DBISQL-16_0/lib/JComponents1600.jar:/opt/sap/DBISQL-16_0/lib/jsyblib1600.jar:/opt/sap/DBISQL-16_0/lib/batik-anim.jar:/opt/sap/DBISQL-16_0/lib/batik-awt-util.jar:/opt/sap/DBISQL-16_0/lib/batik-bridge.jar:/opt/sap/DBISQL-16_0/lib/batik-codec.jar:/opt/sap/DBISQL-16_0/lib/batik-css.jar:/opt/sap/DBISQL-16_0/lib/batik-dom.jar:/opt/sap/DBISQL-16_0/lib/batik-ext.jar:/opt/sap/DBISQL-16_0/lib/batik-extension.jar:/opt/sap/DBISQL-16_0/lib/batik-gui-util.jar:/opt/sap/DBISQL-16_0/lib/batik-gvt.jar:/opt/sap/DBISQL-16_0/lib/batik-parser.jar:/opt/sap/DBISQL-16_0/lib/batik-script.jar:/opt/sap/DBISQL-16_0/lib/batik-svg-dom.jar:/opt/sap/DBISQL-16_0/lib/batik-svggen.jar:/opt/sap/DBISQL-16_0/lib/batik-swing.jar:/opt/sap/DBISQL-16_0/lib/batik-transcoder.jar:/opt/sap/DBISQL-16_0/lib/batik-util.jar:/opt/sap/DBISQL-16_0/lib/batik-xml.jar:/opt/sap/DBISQL-16_0/lib/pdf-transcoder.jar:/opt/sap/DBISQL-16_0/lib/xerces_2_5_0.jar:/opt/sap/DBISQL-16_0/lib/xml-apis-ext.jar:/opt/sap/DBISQL-16_0/lib/xml-apis.jar:::/opt/sap/DBISQL-16_0/lib/commons-codec.jar:/opt/sap/DBISQL-16_0/lib/commons-logging.jar:/opt/sap/DBISQL-16_0/lib/jini-core.jar:/opt/sap/DBISQL-16_0/lib/jini-ext.jar:/opt/sap/DBISQL-16_0/lib/log4j.jar:/opt/sap/DBISQL-16_0/lib/reggie.jar:/opt/sap/DBISQL-16_0/lib/uaf-client.jar sybase.isql.ISQLLoader

[/code]

I'm lost completely...

Thank you.

ryan_hansen
Employee
Employee
0 Kudos

Hi,

I would still use strace, change the dsn name to something specifically unique, and remove the chance a different driver is being picked up through another odbcinst.ini.

You could also use the environment variables and generate a new odbc.ini file. Maybe there is a hidden character that is corrupting this from getting the port number.

Regards,
Ryan

oneeyeman1
Participant
0 Kudos

ryan.hansen ,

I'm positive:

[code]

igor@IgorReinCloud ~/dbhandler/Debug/dbhandler $ 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
Port=5432
igor@IgorReinCloud ~/dbhandler/Debug/dbhandler $ cat /etc/unixODBC/odbcinst.ini
[ODBC]
Trace=yes
TraceFile=/tmp/sql.log

[Sybase]
Description=Native Sybase Driver
Driver=/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb-sqllen8.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 ~/dbhandler/Debug/dbhandler $

[/code]

I have no idea why it picks up wrong thing...

Do you see any issues?

Thank you.

ryan_hansen
Employee
Employee
0 Kudos

Hi,

Have you tried strace to see where the files are loaded from?
The default locations for our system is /etc/odbc.ini

strace -ft -ooutput.log /usr/bin/isql dsnname user password

You can also setup the environment variables (ODBCINI and ODBCSYSINI above for an example) to be sure the correct ones are being picked up.

You can make an obscure name as well and then have no odbcinst.ini file.

cat odbc.ini

[randomsybasetest]
Driver=/to/sybase/directory/DataAccess64/ODBC/lib/libsybdrvodb-sqllen8.so
Description=Sybase 16 Native Driver
Server=asehost
Port=aseport
Database=pubs2
UserID=sa

$ strace -ft -ooutput.log /usr/bin/isql randomsybasetest sa password

[ISQL]ERROR: Could not SQLConnect

$ grep "odbc.ini" output.log
49847 10:42:50 access("/etc/odbc.ini", F_OK) = 0 49847 10:42:50 stat("/etc/odbc.ini", {st_mode=S_IFREG|0777, st_size=2147, ...}) = 0 49847 10:42:50 open("/usr/u/username/.odbc.ini", O_WRONLY|O_CREAT|O_APPEND, 0666) = 3

set ODBCINI and ODBCSYSINI

$ strace -ft -ooutput.log /usr/bin/isql randomsybasetest sa password
+---------------------------------------+

| Connected! |

$ grep "odbc.ini" output.log
49652 10:39:21 access("/to/sybase/directory/DataAccess64/ODBC/odbc.ini", F_OK) = 0

Regards,
Ryan

oneeyeman1
Participant
0 Kudos

ryan.hansen ,

What do you know? 😉

I tried to run "file" on my binary and apparently it is 64-bit binary, which means my OS is 64-bit because I don't pass anything like "-m64" when compiling...

Anyway I switched the driver to be DataAccess64/lib/libsybdrvodb-sqllen8.so and now from my application I'm getting very weird "Invalid Port" .

The sql.log from running my application is:

[code]

[ODBC][10571][1610098572.333767][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x5614bedf6920
[ODBC][10571][1610098572.333882][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][189]
Entry:
Environment = 0x5614bedf6920
Attribute = SQL_ATTR_ODBC_VERSION
Value = 0x3
StrLen = 0
[ODBC][10571][1610098572.333923][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][381]
Exit:[SQL_SUCCESS]
[ODBC][10571][1610098572.333962][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x5614bedf6920
[ODBC][10571][1610098572.335684][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][10571][1610098572.335809][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x5614bedf6920
[ODBC][10571][1610098572.336270][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][10571][1610098572.336329][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x5614bedf6920
[ODBC][10571][1610098572.336568][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][10571][1610098572.336649][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][220]
Entry:
Handle Type = 1
Input Handle = 0x5614bedf6920
[ODBC][10571][1610098589.482915][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x5614beee4400
[ODBC][10571][1610098589.483014][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][189]
Entry:
Environment = 0x5614beee4400
Attribute = SQL_ATTR_ODBC_VERSION
Value = 0x3
StrLen = -6
[ODBC][10571][1610098589.483056][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][381]
Exit:[SQL_SUCCESS]
[ODBC][10571][1610098589.483096][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLAllocHandle.c][377]
Entry:
Handle Type = 2
Input Handle = 0x5614beee4400
[ODBC][10571][1610098589.483143][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLAllocHandle.c][493]
Exit:[SQL_SUCCESS]
Output Handle = 0x5614bec40e00
[ODBC][10571][1610098589.483186][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x5614beee4400
[ODBC][10571][1610098589.483489][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][10571][1610098589.483535][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x5614beee4400
[ODBC][10571][1610098589.483790][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][10571][1610098589.483853][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetConnectAttrW.c][332]
Entry:
Connection = 0x5614bec40e00
Attribute = SQL_ATTR_LOGIN_TIMEOUT
Value = 0x5
StrLen = 0
[ODBC][10571][1610098589.483893][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetConnectAttrW.c][623]
Exit:[SQL_SUCCESS]
[ODBC][10571][1610098589.483942][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDriverConnectW.c][290]
Entry:
Connection = 0x5614bec40e00
Window Hdl = 0x5614bed24290
Str In = [DSN=Sybase16;sa;wasqra;Driver=Postgres;UID=sa;PWD=wasqra][length = 56 (SQL_NTS)]
Str Out = 0x5614bef65f90
Str Out Max = 1024
Str Out Ptr = 0x7ffdb3c54578
Completion = 0
UNICODE Using encoding ASCII 'UTF8' and UNICODE 'UTF16LE'

[ODBC][10571][1610098589.501957][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDriverConnectW.c][699]
Exit:[SQL_ERROR]
[ODBC][10571][1610098589.502075][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x5614bec40e00
Rec Number = 1
SQLState = 0x7ffdb3c540f0
Native = 0x7ffdb3c540a4
Message Text = 0x7ffdb3c54120
Buffer Length = 1024
Text Len Ptr = 0x7ffdb3c5409c
[ODBC][10571][1610098589.502141][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_SUCCESS]
SQLState = [01S00]
Native = 0x7ffdb3c540a4 -> 30011
Message Text = [[SAP][ASE ODBC Driver]Invalid port number]
[ODBC][10571][1610098589.502219][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x5614bec40e00
Rec Number = 2
SQLState = 0x7ffdb3c540f0
Native = 0x7ffdb3c540a4
Message Text = 0x7ffdb3c54120
Buffer Length = 1024
Text Len Ptr = 0x7ffdb3c5409c
[ODBC][10571][1610098589.502259][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_NO_DATA]
[ODBC][10571][1610098598.173821][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetConnectAttrW.c][236]
Entry:
Connection = 0x5614bec40e00
Attribute = 1209
Value = 0x7ffdb3c56ab8
Buffer Length = 0
StrLen = 0x7ffdb3c56ab0
[ODBC][10571][1610098598.174002][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetConnectAttrW.c][325]Error: 08003
[ODBC][10571][1610098598.174075][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x5614bec40e00
Rec Number = 1
SQLState = 0x7ffdb3c56630
Native = 0x7ffdb3c565e4
Message Text = 0x7ffdb3c56660
Buffer Length = 1024
Text Len Ptr = 0x7ffdb3c565dc
[ODBC][10571][1610098598.174141][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_SUCCESS]
SQLState = [08003]
Native = 0x7ffdb3c565e4 -> 0
Message Text = [[unixODBC][Driver Manager]Connection not open]
[ODBC][10571][1610098598.174205][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x5614bec40e00
Rec Number = 2
SQLState = 0x7ffdb3c56630
Native = 0x7ffdb3c565e4
Message Text = 0x7ffdb3c56660
Buffer Length = 1024
Text Len Ptr = 0x7ffdb3c565dc
[ODBC][10571][1610098598.174247][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_NO_DATA]
[ODBC][10571][1610098598.174297][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][290]
Entry:
Handle Type = 2
Input Handle = 0x5614bec40e00
[ODBC][10571][1610098598.174345][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][339]
Exit:[SQL_SUCCESS]
[ODBC][10571][1610098598.174388][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][220]
Entry:
Handle Type = 1
Input Handle = 0x5614beee4400

[/code]

And this is my odbc.ini:

[code]

igor@IgorReinCloud ~/dbhandler/Debug/dbhandler $ 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

[/code]

ryan_hansen
Employee
Employee
0 Kudos

Hi,

Usually if it is a bad port then it will give this error message:

DIAG [HY000] [SAP][ASE ODBC Driver]There is no server listening at host:port.
DIAG [08001] [SAP][ASE ODBC Driver]Client unable to establish a connection
Are you sure you are using what you think you are using?
Str In = [DSN=Sybase16;sa;xxx;Driver=Postgres;UID=sa;PWD=xxx][length = 56 (SQL_NTS)]

The driver output is different from the trace than the odbc.ini

I can reproduce if a port number is not in the odbc.ini file
[Sybase16]
Driver=Adaptive Server Enterprise
Description=Sybase 16 Native Driver
Server=asehost
Database=pubs2
UserID=sa

/usr/bin/isql Sybase16 sa password

DIAG [01S00] [SAP][ASE ODBC Driver]Invalid port number

Use environment variables to specifically use an odbc.ini and odbcinst.ini

ODBCINI=/pse/hansenr/ase160307/DataAccess64/ODBC/odbc.ini ODBCSYSINI=/pse/hansenr/ase160307/DataAccess64/ODBC

ODBCSYSINI doesn't include the filename, just the path

$ pwd
/pse/hansenr/ase160307/DataAccess64/ODBC
$ ls odbc*
odbc.csh odbc.ini odbcinst.ini

odbc.csh is just a script I have created so I can set these environment variables.

$ cat odbc.csh
setenv ODBCINI /pse/hansenr/ase160307/DataAccess64/ODBC/odbc.ini
setenv ODBCSYSINI /pse/hansenr/ase160307/DataAccess64/ODBC
setenv DM_LIBRARY_PATH /pse/hansenr/ase160307/DataAccess64/ODBC/lib
setenv INCLUDE_PATH /usr/local/unixODBC/include

Regards,
Ryan

oneeyeman1
Participant
0 Kudos

@Ryan Hansen,

Below is the sql.log from running my application.

[code]

[ODBC][16166][1610093435.438725][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x557e0e812d00
[ODBC][16166][1610093435.450733][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][189]
Entry:
Environment = 0x557e0e812d00
Attribute = SQL_ATTR_ODBC_VERSION
Value = 0x3
StrLen = 0
[ODBC][16166][1610093435.450825][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][381]
Exit:[SQL_SUCCESS]
[ODBC][16166][1610093435.450870][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x557e0e812d00
[ODBC][16166][1610093435.484828][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][16166][1610093435.484962][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x557e0e812d00
[ODBC][16166][1610093435.485423][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][16166][1610093435.485486][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x557e0e812d00
[ODBC][16166][1610093435.485740][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][16166][1610093435.485799][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][220]
Entry:
Handle Type = 1
Input Handle = 0x557e0e812d00
[ODBC][16166][1610093463.146850][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x557e0e6f7200
[ODBC][16166][1610093463.146956][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][189]
Entry:
Environment = 0x557e0e6f7200
Attribute = SQL_ATTR_ODBC_VERSION
Value = 0x3
StrLen = -6
[ODBC][16166][1610093463.147001][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][381]
Exit:[SQL_SUCCESS]
[ODBC][16166][1610093463.147043][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLAllocHandle.c][377]
Entry:
Handle Type = 2
Input Handle = 0x557e0e6f7200
[ODBC][16166][1610093463.147116][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLAllocHandle.c][493]
Exit:[SQL_SUCCESS]
Output Handle = 0x557e0e707400
[ODBC][16166][1610093463.147160][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x557e0e6f7200
[ODBC][16166][1610093463.147677][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][16166][1610093463.147729][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x557e0e6f7200
[ODBC][16166][1610093463.148113][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][16166][1610093463.148188][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetConnectAttrW.c][332]
Entry:
Connection = 0x557e0e707400
Attribute = SQL_ATTR_LOGIN_TIMEOUT
Value = 0x5
StrLen = 0
[ODBC][16166][1610093463.148231][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetConnectAttrW.c][623]
Exit:[SQL_SUCCESS]
[ODBC][16166][1610093463.148278][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDriverConnectW.c][290]
Entry:
Connection = 0x557e0e707400
Window Hdl = 0x557e0e742290
Str In = [DSN=Sybase16;sa;wasqra;Driver=Postgres;UID=sa;PWD=wasqra][length = 56 (SQL_NTS)]
Str Out = 0x557e0e6f6000
Str Out Max = 1024
Str Out Ptr = 0x7ffe020cee78
Completion = 0
UNICODE Using encoding ASCII 'UTF8' and UNICODE 'UTF16LE'

[ODBC][16166][1610093463.219706][/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
[ODBC][16166][1610093463.219861][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x557e0e707400
Rec Number = 1
SQLState = 0x7ffe020ce9f0
Native = 0x7ffe020ce9a4
Message Text = 0x7ffe020cea20
Buffer Length = 1024
Text Len Ptr = 0x7ffe020ce99c
[ODBC][16166][1610093463.219928][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_SUCCESS]
SQLState = [01000]
Native = 0x7ffe020ce9a4 -> 0
Message Text = [[unixODBC][Driver Manager]Can't open lib '/opt/sap/DataAccess/ODBC/lib/libsybdrvodb.so' : file not found]
[ODBC][16166][1610093463.220012][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x557e0e707400
Rec Number = 2
SQLState = 0x7ffe020ce9f0
Native = 0x7ffe020ce9a4
Message Text = 0x7ffe020cea20
Buffer Length = 1024
Text Len Ptr = 0x7ffe020ce99c
[ODBC][16166][1610093463.220052][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_NO_DATA]
[ODBC][16166][1610093476.579977][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetConnectAttrW.c][236]
Entry:
Connection = 0x557e0e707400
Attribute = 1209
Value = 0x7ffe020d13b8
Buffer Length = 0
StrLen = 0x7ffe020d13b0
[ODBC][16166][1610093476.580227][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetConnectAttrW.c][325]Error: 08003
[ODBC][16166][1610093476.580299][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x557e0e707400
Rec Number = 1
SQLState = 0x7ffe020d0f30
Native = 0x7ffe020d0ee4
Message Text = 0x7ffe020d0f60
Buffer Length = 1024
Text Len Ptr = 0x7ffe020d0edc
[ODBC][16166][1610093476.580363][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_SUCCESS]
SQLState = [08003]
Native = 0x7ffe020d0ee4 -> 0
Message Text = [[unixODBC][Driver Manager]Connection not open]
[ODBC][16166][1610093476.580428][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x557e0e707400
Rec Number = 2
SQLState = 0x7ffe020d0f30
Native = 0x7ffe020d0ee4
Message Text = 0x7ffe020d0f60
Buffer Length = 1024
Text Len Ptr = 0x7ffe020d0edc
[ODBC][16166][1610093476.580882][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_NO_DATA]
[ODBC][16166][1610093476.580956][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][290]
Entry:
Handle Type = 2
Input Handle = 0x557e0e707400
[ODBC][16166][1610093476.581010][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][339]
Exit:[SQL_SUCCESS]
[ODBC][16166][1610093476.581053][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][220]
Entry:
Handle Type = 1
Input Handle = 0x557e0e6f7200

[/code]

I will check the link you posted...

Thank you.

ryan_hansen
Employee
Employee
0 Kudos

Hi,

Maybe it would help with the log. Ryan.hansen@sap.com or this post.

I don't understand why the file cant be loaded unless its OS/permissions problem.
wiki:

https://wiki.scn.sap.com/wiki/display/SYBCON/unixODBC

Regards,

Ryan

oneeyeman1
Participant
0 Kudos

ryan.hansen ,

My application is 32 bit one.and its failing.

I can post the log from running my app if needed.

Thank you.

ryan_hansen
Employee
Employee
0 Kudos

Hi,

You are linked to the 32bit driver, but i bet the unixODBC isql is 64bit. probably a bit mixmatch.

Try to use the DataAccess64 directory for the driver.
Also makes sure the sqllen 8 is used.
libsybdrvodb-sqllen8.so

Also check permissions. That looks like a permissions issue.

Regards,
Ryan

ryan_hansen
Employee
Employee
0 Kudos

Hi,

I don't think that is the problem though.

$ pwd
/pse/hansenr/ase1639/DataAccess/ODBC/lib
$ file libsybdrvodb.so
libsybdrvodb.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped

32bit is included in the installations.

I do not have 32bit unixODBC to test this though.

$ file /usr/bin/isql
/usr/bin/isql: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

Regards,
Ryan

oneeyeman1
Participant
0 Kudos

ryan.hansen ,

Sorry for the long delay.

I just tried to connect with the unixodbc isql.

Here is the results:

[code]

igor@IgorReinCloud ~ $ cd /opt/sap/DataAccess/ODBC/lib/
igor@IgorReinCloud /opt/sap/DataAccess/ODBC/lib $ ls -la
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 /opt/sap/DataAccess/ODBC/lib $

[/code]

And the content of the log file is:

[code]

[ODBC][18591][1608931893.405666][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x562fad6c8a00
[ODBC][18591][1608931893.409328][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLAllocHandle.c][377]
Entry:
Handle Type = 2
Input Handle = 0x562fad6c8a00
[ODBC][18591][1608931893.409441][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLAllocHandle.c][493]
Exit:[SQL_SUCCESS]
Output Handle = 0x562fad6c9b90
[ODBC][18591][1608931893.409512][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLConnect.c][3751]
Entry:
Connection = 0x562fad6c9b90
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][18591][1608931893.426780][/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
[ODBC][18591][1608931893.426929][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][290]
Entry:
Handle Type = 2
Input Handle = 0x562fad6c9b90
[ODBC][18591][1608931893.426980][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][339]
Exit:[SQL_SUCCESS]
[ODBC][18591][1608931893.427024][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][220]
Entry:
Handle Type = 1
Input Handle = 0x562fad6c8a00

[/code]

And the file odbc.ini:

[code]

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

[/code]

Thank you.

oneeyeman1
Participant
0 Kudos

ryan.hansen ,

The problem I am seeing is that while my OS is 64-bit my application is still 32-bit.

And so I can't connect to the server using my software, because I only see 64-bit driver.

This is the problem with the installer - it should install both 32 and 64 bit ODBC drivers and let the user/admin chose proper library for connecting.

Do you see the problem?

Thank you.

ryan_hansen
Employee
Employee
0 Kudos

Our isql is found in:
$SYBASE/$SYBASE_OCS/bin/isql
This would make sure that the ASE is started and the port is working.

ryan_hansen
Employee
Employee
0 Kudos

Hi,

I don't see an issue with your setup besides maybe environment variables or some sort of OS container.

Example:
setenv ODBCINI /pse/hansenr/ase160307/DataAccess64/ODBC/odbc.ini
setenv ODBCSYSINI /pse/hansenr/ase160307/DataAccess64/ODBC
setenv DM_LIBRARY_PATH /pse/hansenr/ase160307/DataAccess64/ODBC/lib
setenv INCLUDE_PATH /usr/local/unixODBC/include

$ cat odbc.ini
[mydsn]
Description = Sybase ODBC Data Source
Driver = Adaptive Server Enterprise
Server = asehost
uid = sa
pwd = password
Port = aseport

$ cat odbcinst.ini
[Adaptive Server Enterprise]
Description = Sybase ODBC Driver
Driver = /pse/hansenr/ase160307/DataAccess64/ODBC/lib/libsybdrvodb-sqllen8.so
FileUsage = -1
UsageCount = 7

$ file /usr/bin/isql
/usr/bin/isql: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

$ /usr/bin/isql mydsn
+---------------------------------------+
| Connected! |

libsybdrvodb-sqllen8.so is most likely the one you want to use. This is for newer versions of unixODBC, but this would most likely affect the visual data not the connection.

I'm sure you have done this, but make sure the port is open with sybase isql
isql -Uusername -Ppassword -Sasehost:aseport

strace would show the same results I'm assuming as the file cannot be found.
strace -ft -ooutput.log /usr/bin/isql mydsn

You could try copying the driver to another directory.
The error suggests either an environment issue or OS issue.

Regards,
Ryan