Setting Up Open Data Services

In the following example, the gateway application sets up Open Data Services.

  1. Specify a server process, define the configuration structure for the server, define a pointer for the server's Windows NT Registry key name, and define a pointer for the server name at the remote data source:
    SRV_SERVER *server;                  // The service process        
    SRV_CONFIG *config;                  // The configuration structure
    DBCHAR *RegistryName = "Gateway";    // Registry lookup name       
    DBCHAR *SrvrName = "";               // Default remote server name 
    
  2. Read the command-line argument to get the name of the remote server to use and send the remote server name to the gateway's DLL:
    // Read any command-line arguments. 
    getargs(argc, argv);
    
    // Send the name retrieved to the gateway's DLL module. 
    set_remote_server_name(SrvrName);
    
  3. Allocate a configuration structure, initialize it to allow 20 client connections, and define the log file as GATEWAY.LOG:
    // Allocate a configuration structure that is used to initialize 
    // the Open Data Services server application.                    
    config = srv_config_alloc();
    
    // Allow 20 connections at a time.  
    srv_config(config, (DBINT)SRV_CONNECTIONS, "20", SRV_NULLTERM);
    
    // Set the log file.     
    srv_config(config, (DBINT)SRV_LOGFILE, "gateway.log", SRV_NULLTERM);