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?

asked 21 Jun, 05:45

bluefrog's gravatar image

bluefrog
594
accept rate: 0%

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.

(21 Jun, 11:43) bluefrog

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');
permanent link

answered 21 Jun, 06:14

Volker%20Barth's gravatar image

Volker Barth
30.8k308456665
accept rate: 32%

converted 21 Jun, 10:13

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

permanent link

answered 21 Jun, 11:54

Ian%20McHardy's gravatar image

Ian McHardy
3.1k23353
accept rate: 39%

edited 21 Jun, 11:55

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×130

question asked: 21 Jun, 05:45

question was seen: 82 times

last updated: 21 Jun, 11:55