Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » SQL Anywhere Server - Programming » SQL Anywhere Data Access APIs » SQL Anywhere web services

 

Starting a database server that listens for web requests

When you want a database server to listen for web service requests over HTTP or HTTPS, you must specify the types of web requests it is to listen on the command line when you start the server. By default, database servers do not listen for web service requests, leaving no way for clients to access any services that may be defined in your database.

You can also specify various properties of an HTTP or HTTPS service on the command line, such as on which port they are to listen.

You must also create web services within the database. See Creating web services.

You use the -xs option to enable protocols. The two available web service protocols are HTTP and HTTPS. Optional parameters, placed within parentheses after the protocol name, let you customize access to each type of web service.

The general syntax of the option is as follows:

-xs { protocol [ (option=value; ...) ], ... }
Starting multiple web servers

If you want to start multiple web servers at the same time, then you must change the port for additional web servers since they all have the same default port.

Protocols

The following web service protocol values are available:

  • http   Listen for HTTP connections.

  • https   Listen for HTTPS connections. HTTPS connections using SSL version 3.0 and TLS version 1.0 are supported.

  • none   Do not listen for web service requests. This is the default setting.

Options

The following are some of the options that are available:

  • FIPS   Specify FIPS=Y to listen for HTTPS FIPS connections.

  • ServerPort [PORT]   The port on which to listen for web requests. By default, SQL Anywhere listens on port 80 for HTTP requests and on port 443 for secure HTTP (HTTPS) requests. The default port for FIPS-approved HTTPS connections is the same as for HTTPS.

    For example, if you already have a web server running on port 80, you could use the following options to start a database server that listens for web requests on port 8080:

    dbeng11 mywebapp.db -xs http(port=8080)

    As another example, the following command starts a secure web server using the sample identity file included with SQL Anywhere (you must have installed RSA or FIPS-approved RSA encryption to have this file). It should be entered on a single line.

    dbeng11 -xs https(identity=rsaserver.id;
                     identity_password=test)
    Caution

    The sample identity file is intended for use only during testing and development. It provides no protection because it is a standard part of SQL Anywhere. Replace it with your own certificate before deploying your application.

  • DatabaseName [DBN]   Specifies the name of a database to use when processing web requests, or uses the REQUIRED or AUTO keyword to specify whether database names are required as part of the URL.

    If this parameter is set to REQUIRED, the URL must specify the database name.

    If this parameter is set to AUTO, the URL may specify a database name, but does not need to do so. If the URL contains no database name, the default database on the server is used to process web requests.

    If this parameter is set to the name of a database, that database is used to process all web requests. The URL must not contain a database name.

  • LocalOnly [LOCAL]   When set to YES, this parameter causes a network database server to reject all connections from clients running on different computers. This option has no effect on personal database servers, which never accept web service requests from other computers. The default value is NO, which means accept requests from clients no matter where they are located.

  • LogFile [LOG]   The name of the file to which the database server is to write information about web service requests.

  • LogFormat [LF]   Controls the format of messages written to the log file and which fields appear in them. If they appear in the string, current values are substituted for the codes, such as @T, when each message is written.

    The default value is @T - @W - @I - @P - "@M @U @V" - @R - @L - @E, which produces messages such as the following:

    06/15 01:30:08.114 - 0.686 - 127.0.0.1 - 80
     - "GET /web/ShowTable HTTP/1.1" - 200 OK - 55133 -

    The format of the log file is compatible with Apache, so the same tools can be used to analyze it.

    For more information about field codes, see LogFormat protocol option [LF].

  • LogOptions [LOPT]   Allows you to specify keyword and error numbers that control which messages, or types of messages, are written to the log file. See LogOptions protocol option [LOPT].

For a complete list of the available options and details about them, see Network protocol options.