Forcing A Specific Port Number For The SQL Anywhere 17 Database

The ability to specify a particular port for the database server is possible by adding in an additional parameter. By default, the database will always try to utilize port 2638 and in 99.9% of cases it does. The only times I can recall it doesn’t if if another instance of the database server was already launched and running. It’s technically possible something has been deliberately set to use that same particular port or port range, but can’t say I’ve seen an instance of that with the last two iterations of SQL Anywhere.

This can be done in both the server.txt file that’s used when manually starting a database server and the .bat file used to create the associated service.

You’ll add the following immediately after the ‘-x tcpip’ portion. You can substitute whatever port you’d like to use if you don’t want to stick to 2638 & 2639.

Server.txt

Service .bat file

After applying these changes, the database server must be restarted in order to recognize them. In the service’s case, you’ll need to re-run the updated .bat file to replace the existing service. Stop the existing one and during the recreation of the service, it should restart the database.