Specifies the port the database server is running on.
{ ServerPort | PORT }=port-number
TCP/IP, HTTP, HTTPS
port-number For a database server, the ServerPort protocol option designates the port number on which to communicate using TCP/IP.
You can specify a single port number, or a combination of individual port numbers and ranges of port numbers. When you specify a list and/or range of port numbers, the database server attempts to bind to all specified port numbers. For example:
For a client, the ServerPort (PORT) protocol option informs the client of the port or ports on which database servers are listening for TCP/IP communication. The client broadcasts to every port that is specified by the ServerPort (PORT) protocol option to find the database server.
TCP/IP 2638
HTTP 80
HTTPS 443
Every application using TCP/IP on a computer uses a distinct TCP/IP port so that network packets end up at the right application. The Internet Assigned Numbers Authority has assigned the SQL Anywhere database server port number 2638 to use for TCP/IP communications. However, other applications are not disallowed from using this reserved port, and this may result in an addressing collision between the database server and another application.
On the server On the server, when you specify the ServerPort (PORT) protocol option, only the specified port number is used for TCP/IP connections. UDP listeners use both the specified port number and the default port number (2638). If you do not specify the ServerPort protocol option, the default port (2638) is used.
On the client When you specify the ServerPort (PORT) protocol option, only the specified port number is used for TCP/IP connections and UDP broadcasts. If you do not specify the ServerPort protocol option, port 2638 is used.
If the server is running on a port other than 2638, the application can usually connect to the server by providing the server name but no port number. The port number must be specified if the database server is running on Mac OS X or if the -sb server option is used.
Mac OS X does not allow multiple processes to bind to the same UDP port. When the database server is running on one of these platforms, it only listens to the specified UDP port or port 2638 if no port is specified.
This means that clients must specify the TCP/IP port number if the database server is not using the default port (2638).
For example if the database server is started with the command dbsrv12 -n MyServer "samples-dir/demo.db"
, a client on the same subnet can find the server using the following connection parameters Server=MyServer;LINKS=tcpip
. If another database server is started on Mac OS X, with the following command dbsrv12 -n SecondServer "-x tcpip(PORT=7777) samples-dir/demo.db"
, a client on the same subnet can find the server using the connection parameters Server=SecondServer;LINKS=tcpip(PORT=7777)
. If the database server was running on a platform other than Mac OS X, then the client would not need to specify the PORT
parameter.
Additionally, on Mac OS X, if a SQL Anywhere database server is already using port 2638, and a second network database server was started without the PORT protocol option, the second network server would fail to start. The reason for this is users need to know and specify the server's port number in their connection parameters. Personal servers start successfully, even if port 2638 is in use, because shared memory is normally used to connect to personal servers.
If you using a web server, by default, the database server listens on the standard HTTP and HTTPS ports of 80 and 443, respectively.
The following examples show how to use the PORT protocol option.
Start a network database server:
dbsrv12 -x tcpip -n server1 |
Port number 2638 is now taken.
Attempt to start another database server:
dbsrv12 -x tcpip -n server2 |
The default port is currently allocated, and so the server starts on another port. The port number is displayed on the server messages window. On Mac OS X, this will fail.
Start a database server on port 2629:
dbsrv12 -x tcpip(ServerPort=2629) -n server3 c:\mydata.db |
Assuming that server3 was started on host serverhost3, connect to the server3 using the Host connection parameter from dbisql:
dbisql -c "UID=DBA;PWD=sql;ServerName=server3;Host=serverhost3:2629" |
Assuming that server3 was started on host serverhost3, connect to the server3 using the CommLinks connection parameter from dbisql:
dbisql -c "UID=DBA;PWD=sql;ServerName=server3;CommLinks=tcpip(HOST=serverhost3;PORT=2629)" |
In this example, another web server on your computer is already using port 80 or you do not have permission to start a server on this low of a port number. Start a server that listens on an alternate port, such as 8080:
dbsrv12 -xs http(PORT=8080) -n server3 web.db |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |