Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

I have the following problem: Our software is deployed to several machines. Each deployment of our software installs an SQL Anywhere 10 server instance which is registered to start as a service with the following network parameters:

-n MyServer -x tcpip(PORT=2638,8200-8205) -z -sb 0 -o d:serverlg.txt

We do not currently have a way to know if a given port is taken, and it happenned to us that the port 2638 is taken by another process. According to the documentation of the PORT option, giving a range of ports when registering the service was meant to indicate to the engine to keep trying the ports defined in the range, until it found one that is free. This is sadly not the case.

As it stands, there is no point in providing a range of ports to start, since if the first port is not free, the engine will not start at all.

Is there any workaround for this issue?

asked 12 Oct '12, 12:46

Sergio's gravatar image

accept rate: 0%

edited 15 Mar '13, 21:09

Mark%20Culp's gravatar image

Mark Culp


FWIW the V10 Help for ServerPort does say this: "When you specify a list and/or range of port numbers, the application keeps trying port numbers until it finds one to which it can successfully bind."

However, the V12 Help says something ambiguous instead: "When you specify a list and/or range of port numbers, the database server attempts to bind to all specified port numbers."

The problem may be that the V10 Help is wrong... that's what your experience seems to indicate.

However... the V10 Help version does sound more attractive! :)

(12 Oct '12, 13:21) Breck Carter

The PORT TCP/IP option on the server indicates that the server is to listen to all of the listed port numbers. This should not be confused with the PORT TCP/IP option that is specified in a client connection string which specifies a list of ports that are tried, in turn, to connect to the server.

Please see this page in the documentation that describes the above.

In your specific case, you should choose a port that is not assigned to any application from tne IANA Ports List and then start your server using that port. Better yet, apply to IANA for a port to be assigned your application since this should guarentee that your port number will not be in use on the computer.

An alternative is to not specify a port number at all and let the server randomly pick one. Your client application can then connect to the server by specifying the host name, server name, and database name.

permanent link

answered 12 Oct '12, 13:10

Mark%20Culp's gravatar image

Mark Culp
accept rate: 41%

The problem with letting the Server pick a random port is that we also need to open this port in the firewall during Installation. This was the reason for providing only a range of ports for the engine,so that we just opened a few ports in the firewall. Is there a way to find out which port the engine has taken?

(13 Oct '12, 02:58) Sergio
Replies hidden

The following should to the trick - it lists all the addresses (including ports) the server is listening on:

SELECT property('TcpipAddresses');
(13 Oct '12, 11:02) Volker Barth

Adding to Volker's comment you can inquiry the addresses via dbping (using additional parms if needed to connect):

dbping -c "UID=dba;PWD=xxxxx;ENG=servername" -ps TcpIpAddresses
(13 Oct '12, 11:18) Derli Marcochi
Your answer
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 12 Oct '12, 12:46

question was seen: 3,062 times

last updated: 15 Mar '13, 21:09