cancel
Showing results for 
Search instead for 
Did you mean: 

SAP ASE throwing "Invalid port number"

oneeyeman1
Participant
0 Kudos

Hi,

I am trying to connect with the SAP ODBC driver to the running instance of SAP ASE 16.

Both are running on the same Linux maxchine (not VM).

Here is some info:

[code]

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

[/code]

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

[/code]

And here is the log:

[code]

[ODBC][684][1612428302.021117][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x555555bdb4a0
[ODBC][684][1612428302.021236][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][189]
Entry:
Environment = 0x555555bdb4a0
Attribute = SQL_ATTR_ODBC_VERSION
Value = 0x3
StrLen = 0
[ODBC][684][1612428302.021278][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][381]
Exit:[SQL_SUCCESS]
[ODBC][684][1612428302.021320][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x555555bdb4a0
[ODBC][684][1612428302.083091][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][684][1612428302.083221][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x555555bdb4a0
[ODBC][684][1612428302.083581][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][684][1612428302.083639][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x555555bdb4a0
[ODBC][684][1612428302.083851][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][684][1612428302.083909][/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 = 0x555555bdb4a0
[ODBC][2966][1612428463.420810][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x555555bc9ea0
[ODBC][2966][1612428463.420919][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][189]
Entry:
Environment = 0x555555bc9ea0
Attribute = SQL_ATTR_ODBC_VERSION
Value = 0x3
StrLen = 0
[ODBC][2966][1612428463.420961][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][381]
Exit:[SQL_SUCCESS]
[ODBC][2966][1612428463.421004][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x555555bc9ea0
[ODBC][2966][1612428463.479052][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][2966][1612428463.479189][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x555555bc9ea0
[ODBC][2966][1612428463.479558][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][2966][1612428463.479615][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x555555bc9ea0
[ODBC][2966][1612428463.479822][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][2966][1612428463.479880][/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 = 0x555555bc9ea0
[ODBC][2966][1612428478.091316][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x555555ae8a00
[ODBC][2966][1612428478.091431][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][189]
Entry:
Environment = 0x555555ae8a00
Attribute = SQL_ATTR_ODBC_VERSION
Value = 0x3
StrLen = -6
[ODBC][2966][1612428478.091474][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetEnvAttr.c][381]
Exit:[SQL_SUCCESS]
[ODBC][2966][1612428478.091516][/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 = 0x555555ae8a00
[ODBC][2966][1612428478.091602][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLAllocHandle.c][493]
Exit:[SQL_SUCCESS]
Output Handle = 0x555555acb000
[ODBC][2966][1612428500.511345][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][122]
Entry:
Environment = 0x555555ae8a00
[ODBC][2966][1612428500.511789][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDataSourcesW.c][323]
Exit:[SQL_SUCCESS]
[ODBC][2966][1612428629.087465][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetConnectAttrW.c][332]
Entry:
Connection = 0x555555acb000
Attribute = SQL_ATTR_LOGIN_TIMEOUT
Value = 0x5
StrLen = 0
[ODBC][2966][1612428629.087582][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLSetConnectAttrW.c][623]
Exit:[SQL_SUCCESS]
[ODBC][2966][1612428642.597571][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDriverConnectW.c][290]
Entry:
Connection = 0x555555acb000
Window Hdl = 0x555555af2260
Str In = [DSN=Sybase16;sa;wasqra;Driver=Sybase;UID=sa;PWD=wasqra][length = 54 (SQL_NTS)]
Str Out = 0x555555cf2100
Str Out Max = 1024
Str Out Ptr = 0x7fffffff8bb8
Completion = 0
UNICODE Using encoding ASCII 'UTF8' and UNICODE 'UTF16LE'

[ODBC][2966][1612428642.960398][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDriverConnectW.c][699]
Exit:[SQL_ERROR]
[ODBC][2966][1612428715.454145][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x555555acb000
Rec Number = 1
SQLState = 0x7fffffff8730
Native = 0x7fffffff86e4
Message Text = 0x7fffffff8760
Buffer Length = 1024
Text Len Ptr = 0x7fffffff86dc
[ODBC][2966][1612428715.454290][/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 = 0x7fffffff86e4 -> 30011
Message Text = [[SAP][ASE ODBC Driver]Invalid port number]
[ODBC][2966][1612429099.519901][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x555555acb000
Rec Number = 2
SQLState = 0x7fffffff8730
Native = 0x7fffffff86e4
Message Text = 0x7fffffff8760
Buffer Length = 1024
Text Len Ptr = 0x7fffffff86dc
[ODBC][2966][1612429099.520093][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_NO_DATA]
[ODBC][2966][1612429136.445542][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetConnectAttrW.c][236]
Entry:
Connection = 0x555555acb000
Attribute = 1209
Value = 0x7fffffffb118
Buffer Length = 0
StrLen = 0x7fffffffb110
[ODBC][2966][1612429136.445670][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetConnectAttrW.c][325]Error: 08003
[ODBC][2966][1612429136.445778][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x555555acb000
Rec Number = 1
SQLState = 0x7fffffffac90
Native = 0x7fffffffac44
Message Text = 0x7fffffffacc0
Buffer Length = 1024
Text Len Ptr = 0x7fffffffac3c
[ODBC][2966][1612429136.445844][/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 = 0x7fffffffac44 -> 0
Message Text = [[unixODBC][Driver Manager]Connection not open]
[ODBC][2966][1612429136.445909][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
Entry:
Connection = 0x555555acb000
Rec Number = 2
SQLState = 0x7fffffffac90
Native = 0x7fffffffac44
Message Text = 0x7fffffffacc0
Buffer Length = 1024
Text Len Ptr = 0x7fffffffac3c
[ODBC][2966][1612429136.445987][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
Exit:[SQL_NO_DATA]
[ODBC][2966][1612429136.446035][/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 = 0x555555acb000
[ODBC][2966][1612429136.446118][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][339]
Exit:[SQL_SUCCESS]
[ODBC][2966][1612429136.446163][/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 = 0x555555ae8a00

[/code]

I have unixODBC 2.3.5.

Does anyone have an idea?

Thank you.

Accepted Solutions (0)

Answers (13)

Answers (13)

oneeyeman1
Participant
0 Kudos

@Mark A Parsons,

I believe I figured all this out. (The big thank you goes to the authors of freeTDS).

However, I found an issue with the native driver (from Sybase). I will create a new thread for that.

Thank you.

oneeyeman1
Participant
0 Kudos

@Mark A Parsons,

[code]

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

[/code]

[code]

igor@IgorReinCloud /opt/sap $ cat interfaces

REINCLOUD
master tcp ether localhost 5000
master tcp ether IgorReinCloud 5000
query tcp ether localhost 5000
query tcp ether IgorReinCloud 5000


REINCLOUD_BS
master tcp ether localhost 5001
query tcp ether localhost 5001


REINCLOUD_XP
master tcp ether localhost 5002
query tcp ether localhost 5002


REINCLOUD_JSAGENT
master tcp ether localhost 4900
query tcp ether localhost 4900

igor@IgorReinCloud /opt/sap $

[/code]

[code]

igor@IgorReinCloud /opt/sap $ ps aux | grep -i reincloud
root 10798 0.0 0.0 13720 3220 pts/1 S Feb05 0:00 /bin/sh ./RUN_REINCLOUD
root 10799 1.5 18.6 5844132 1466968 ? Ssl Feb05 15:54 /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
root 10948 0.0 0.1 319452 11740 ? Ssl Feb05 0:03 /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 17477 0.0 0.0 12984 2224 pts/0 S+ 13:51 0:00 grep --colour=auto -i reincloud
igor@IgorReinCloud /opt/sap $

[/code]

Thank you.

This is with native SAP ODBC driver. I may try the freeTDS one later today.

EDIT:

I just noticed that the "-p" parameter passed is using "4900" and not "5000".

Is there a way to verify that ASE is definitely listening on the port "5000"?

Thank you.

oneeyeman1
Participant
0 Kudos

@Mark A Parsons,

OK, after doing this Sybase/ASE isql works. (the first one).

The second command fails with:

[code]

ct-connect: network packet layer: internal net library error: Protocol driver call to parse connection information failed.

[/code]

And so fails the one that comes with unixODBC. And my program still fails with the same "Invalid port number" error.

Thank you.

oneeyeman1
Participant
0 Kudos

@Avinash Kothare,

[code]

igor@IgorReinCloud /opt/sap $ OCS-16_0/bin/isql Sybase16 sa
Password:
CT-LIBRARY error:
ct_connect(): directory service layer: internal directory control layer error: Requested server name not found.

[/code]

oneeyeman1
Participant
0 Kudos

@Mark A Parsons,

[code]

igor@IgorReinCloud ~/dbhandler/Debug $ hostname
IgorReinCloud

igor@IgorReinClous

[/code]

[code]

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

oneeyeman1
Participant
0 Kudos

avinash_kothare64 ,

I'm not using isql - I'm running my software.

former_member89972
Active Contributor
0 Kudos

Good.

In that case can you check & verify if the host + port is correctly responding

to isql (from SAP/Sybase) and specifying the interfaces file you have ?

If you get 1> prompt, it will confirm that server (host + port) are working as expected.

And if that succeeds, try other (i.e. non SAP/Sybase) "isql" to see if your ODBC set up is correct.

If both work as expected then ASE & ODBC set up is correct and focus will be your program/code.

Avinash

former_member89972
Active Contributor
0 Kudos

By any chance are you using incorrect "isql" (i.e. one that came with unixODBC) ?

isql from SAP/Sybase is different than one mentioned above.

HTH

Avinash

oneeyeman1
Participant
0 Kudos

iron_horse

So I modified my interfaces file as follows:

[code]

igor@IgorReinCloud ~/dbhandler/Debug $ cat /opt/sap/interfaces

REINCLOUD
master tcp ether localhost 5000
master tcp ether REINCLOUD 5000
query tcp ether localhost 5000
query tcp ether REINCLOUD 5000


REINCLOUD_BS
master tcp ether localhost 5001
query tcp ether localhost 5001


REINCLOUD_XP
master tcp ether localhost 5002
query tcp ether localhost 5002


REINCLOUD_JSAGENT
master tcp ether localhost 4900
query tcp ether localhost 4900

[/code]

restarted the server and I am still getting the same error.

Thank you.

c_baker
Employee
Employee
0 Kudos

Correct. As I have mentioned, the interfaces file is not used. Therefore the 'Server' as defined in the odbc.ini file cannot be used, which my previous instructions also discuss.

You need to replace the 'Server=REINCLOUD' in your odbci.ini with either of:

  • Server=localhost

or

  • Server=127.0.0.7

(Also - as set up, the ASE is only listening to connections from the localhost machine. You will need to define additional lines in the interfaces file, and restart the ASE service, if you expect to connect to the ASE from another machine. For now however, these above instructions should be sufficient.)

Chris

oneeyeman1
Participant
0 Kudos

c.baker

If you look at my odbc.ini file, you will see that I have "port" and "server" parameters

So what am I missing?

Could you please send me an example file?

I'm trying to connect locally on the localhost where the server is running.

Thank you.

EDIT::

Below is the content of my interfaces file:

[code]

REINCLOUD

master tcp ether localhost 5000

query tcp ether localhost 5000

[/code]

In addition - this page https://wiki.scn.sap.com/wiki/display/SYBCON/unixODBC doesn't say anything about "interfaces" file..

c_baker
Employee
Employee
0 Kudos

The 'interfaces' file is a directory service used by ASE to assign the port it will be using to listen. It is also the file used by OpenClient applications to determine where to find the ASE.

When an ASE starts it uses the interfaces file to set up the communications listeners for that instance. Based on information included in your post, you interfaces file is most likely '/opt/sap/interfaces' on the machine where you installed ASE.

The ODBC driver is a wire-level driver, so does not require the interfaces file to decode the location and port of the server. By default it needs the actual host(server) and port that the ASE is listening on, not the interfaces name.

The Linux structure of the intefaces file is given at: https://help.sap.com/viewer/8e3f3bdaa6104c63ac233caa6cdb13a5/16.0.4/en-US/bfb6a9a16db61014bf8f040071... (keep in mind, some entries are optional).

For your <SERVERNAME> as 'REINCLOUD' you will want the <network> value as your ODBC DSN 'server' entry and the <host port> as your ODBC DSN 'port'. For your install both the 'master' and 'query' probably match, so use either.

Chris

oneeyeman1
Participant
0 Kudos

c.baker

And how do I check it? What do I do if its not?

I just installed it and it started. I just presumed that thats what will be used.

Now I'm trying to connect through my software and am getting that error.

Thank you.

c_baker
Employee
Employee
0 Kudos

The driver does not use the 'interfaces' file. Make sure your server, REINCLOUD, is a FQDN or IP address.

https://help.sap.com/viewer/b3c09d30f5d148fb8339f43f9f029ff0/16.0.4/en-US/b1dd3876bbf910149ce1e9ba11...

Chris