Home | Previous Page | Next Page   Connecting to the Database > Using an HTTP Proxy Server >

Configuring Your Environment to Use a Proxy Server

The HTTP proxy requires a Web server that supports servlets, preferably a Web server whose servlet engine uses a 2.1 or greater servlet API. The proxy is compatible with 2.0 and earlier servlet APIs, but the PROXYTIMEOUT feature is only enabled with a 2.1 or greater API.

To configure your environment for a proxy server
  1. Define a servlet alias or context for the proxy servlet in your Web server configuration.

    The JDBC driver directs all client HTTP requests to:

    http://your-web-server:port/pathname/IfxJDBCProxy

    where IfxJDBCProxy is the proxy servlet and pathname is the path to the proxy servlet. Consult your Web server documentation for the correct way to configure servlets.

  2. Copy three class files—IfxJDBCProxy.class, SessionMgr.class, and TimeoutMgr.class—to the servlet directory you specified in the previous step.

    These class files reside in the directory proxy, which is under the installation directory for IBM Informix JDBC Driver after the product bundle is installed.

  3. Add the IBM Informix JDBC Driver file, ifxjdbc.jar, to the CLASSPATH setting on your Web server.

    Some Web servers use the CLASSPATH of the environment under which the server is started, while others get their CLASSPATH from a Web server-specific properties file. Consult your Web server documentation for the correct place to update the CLASSPATH setting.

  4. Start your Web server and verify that the proxy is installed correctly by entering the following URL:
    http://server-host-name:port-number/servlet/
       IfxJDBCProxy

    The proxy replies with the following banner:

    -- Informix Proxy Servlet v220 Servlet API 2.1 --

    v220 represents the Informix proxy version. Servlet API 2.1 represents the version of your Web server's servlet API.

    If the servlet API is 2.0 or earlier, the banner says Servlet API 0.0.

  5. After configuring the proxy, append the following to your applet or application's URL:
    PROXY=server-host-name:port-number

    For example:

    jdbc:informix-sqli://123.45.67.89:1533:INFORMIXSERVER=
       myserver;user=rdtest;password=test;
       PROXY=webserver:1462;

Depending on your Web server, the proxy servlet might be loaded when the Web server is started or the first time it is referenced in the URL of your applet or application connection object.

The following Web sites offer more information about proxy servlets:

Specifying a Timeout

You can specify a timeout value for the proxy by using the PROXYTIMEOUT keyword. The PROXYTIMEOUT value specifies how often the client-side JDBC driver should send a keepalive request to the proxy. A PROXYTIMEOUT value is represented in seconds; the value can be 60 or greater.

When PROXYTIMEOUT is specified by the client, the proxy sets the client's session expiration equal to 2 x PROXYTIMEOUT. For example, if PROXYTIMEOUT is set to 60 seconds, the proxy sets the client's expiration time to 120 seconds. When the expiration time is reached, the proxy removes the client's session resources and closes its database connection.

The proxy resets the timeout interval each time a communication is received from the client. Here are some valid values for PROXYTIMEOUT:

PROXYTIMEOUT=-1
Disables the client timeout feature.
PROXYTIMEOUT=nnn
Client sends a keepalive request to proxy every nnn seconds. The nnn value must be 60 or greater.
PROXYTIMEOUT=60
Default value if PROXYTIMEOUT is not specified

The proxy timeout feature is helpful in determining if a client session has terminated without first sending the proxy a close request by closing the JDBC connection. The proxy maintains an open database connection on behalf of the client until the client either:

The onstat database utility shows an open session for any client sessions that have unexpectedly terminated and have set PROXYTIMEOUT to -1.

Here is an example that specifies PROXYTIMEOUT:

jdbc:informix-sqli://123.45.67.89:1533:informixserver=myserver;
   user=rdtest;password=test;
   PROXY=webserver:1462?PROXYTIMEOUT=180;

See the demo/proxy directory under the directory where your driver is installed for an example applet and application that uses the proxy.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]