Lesson 3: Configuring the consolidated database to act as the message server

In this lesson, you configure the consolidated database to act as the message server for the HTTP message system. It is also possible to configure a separate database and database server to act as the message server.

 Configure the consolidated database to act as the message server
  1. Using Interactive SQL, connect as a user with DBA authority:

    dbisql -c "SERVER=cons;DBN=cons;UID=DBA;PWD=sql"
  2. When a database is first initialized, none of the web services needed to accept HTTP requests from remote users is defined, and neither are definitions to allow the database server to access the directory where the message files are stored. The creation of these objects is automated with the use of the sr_add_message_server stored procedure, which takes an optional parameter to specify who owns all the objects. Execute the following statements on the consolidated database (cons) to define all the objects needed for the message server, and specify that all the objects are owned by the cons user:

    GRANT GROUP TO cons;
    SET REMOTE http OPTION cons.root_directory='c:\\tutorial\\messages';
    CALL sr_add_message_server( 'cons' );
    COMMIT;
  3. Some extra configuration is needed when the Relay Server will be forwarding HTTP requests to a back-end SQL Anywhere server. It is possible to set up a high-availability environment for your back-end SQL Anywhere servers where some nodes are defined as read-only and some are defined as read-write nodes. In this tutorial, there is only a single database server in the system, so you need to define the database as a read-write node. Execute the following statements on the consolidated database (cons) to define all the objects needed so that the Relay Server recognizes this database server as a read-write node:



    CREATE PROCEDURE sp_oe_read_status()
    RESULT (doc LONG VARCHAR)
    BEGIN
    DECLARE res LONG VARCHAR;
    SET res='AVAILABLE=TRUE';
    CALL sa_set_http_header('Content-Length', LENGTH(res) );
    SELECT res;
    END;
    GO
    	
    CREATE SERVICE oe_read_status
    TYPE 'raw'
    AUTHORIZATION OFF
    SECURE OFF
    USER DBA
    AS CALL sp_oe_read_status();
    GO
  4. Disconnect from Interactive SQL.

  5. The outbound enabler acts as a channel between the Relay Server and the back-end SQL Anywhere database. On the machine_cons computer start the Relay Server Outbound Enabler (RSOE) with the following command line:

    rsoe -cr "host=machine_iis;port=80;url_suffix=/rs/server/rs_server.dll" 
    -cs "host=machine_cons;port=8033;status_url=/oe_read_status"
    -f srhttp_tutorial_farm -id srhttp_tutorial_server -v 5 -o rsoe.log
    
  6. Proceed to Lesson 4: Creating the remote database.