cancel
Showing results for 
Search instead for 
Did you mean: 

identify port

Former Member
0 Kudos
4,331

How do I find out what port I should connect with to a SQL Anywhere 17 database running on Linux 64 bit?

Assuming I have access to the database server and I can query any view?

Former Member
0 Kudos

Hi

thanks for your reply. I started using SQL Anywhere for the first time this week having used Oracle for over 5 years. Setting up the listener and the port are two separate tasks in Oracle.

I eventually figured out where to create a listener in SQL Central for an existing database.

Accepted Solutions (1)

Accepted Solutions (1)

VolkerBarth
Contributor

Hm, I do not understand your question - if you are already successfully connected to the database, why would you need to know the port to connect (except you are connected locally via Shared Memory and want to know how different machines can connect via TCP/IP)?

The following tells the server's used TCP/IP addresses and ports:

select property('TcpIpAddresses');

For current connections, you can use the builtin sa_conn_info() procedure to check the "ServerPort" column (by default 2638) for connections with ColmmLink = 'TCPIP':

call sa_conn_info();

The following might also help to get address and port for the current connection:

select PropName, PropDescription, Value
from sa_conn_properties(-1)
where PropName in ('ServerNodeAddress', 'ServerPort');

Answers (1)

Answers (1)

ian_mchardy
Advisor
Advisor

If you want to specify the port that the server should listen to, specify "-x tcpip(port=xxxx)" as part of the dbsrv17 command line options. If you specify "-x tcpip" with no port, the server defaults to port 2638 unless 2638 is already in use, and if 2638 is in use, the server listens to an available port 49152 or higher.

You have two general work flows:

  1. The simplest and most reliable is to specify the port with "-x tcpip(port=xxxx)", and then on the client connection string use the HOST connection parameter to specify the hostname/ip address and port. For example, HOST=myhost:2638.
  2. Don't specify the port when starting the server and let the server choose 2638 or a free port. Then when connecting, use the HOST connection parameter to specify the hostname or ip address but no port AND use the ServerName connection parameter to specify the server name (specified by -n on the server command line). For example, HOST=myhost;ServerName=myservername. This works in most cases, however on some OS's or when there are multiple SQL Anywhere servers running, this may not be reliable.

Kind regards,

Ian