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?
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.
answered 12 Oct '12, 13:10