Using the driver in an applet

About this task

You can use Informix® JDBC Driver in an applet to connect to the Informix database from a web browser. The following steps show how to specify Informix JDBC Driver in the applet and how to ensure that the driver is correctly downloaded from the web server.

To use Informix JDBC Driver in an applet:

Procedure

  1. Install ifxjdbc.jar in the same directory as your applet class file.
  2. Specify ifxjdbc.jar in the ARCHIVE attribute of the APPLET tag in your HTML file, as shown in the following example:
    <APPLET ARCHIVE=ifxjdbc.jar CODE=my_applet.class
    CODEBASE=http://www.myhost.com WIDTH=460 HEIGHT=160>
    </APPLET>

Results

Important: Some browsers do not support the ARCHIVE attribute of the APPLET tag. If this is true of your browser, unpack and install the ifxjdbc.jar file in the root directory of your web server. If your browser also does not support the JDBC API, you must install the class files included in the java.sql package in the root directory of the web server. See your web server documentation for information about installing files in the root directory.
Because unsigned applets cannot access some system resources for security reasons, the following features of Informix JDBC Driver do not work for unsigned applets:
  • The sqlhosts file and LDAP server access. The host name and port number properties or service name of the Informix database server in the database URL are optional if you are referencing an sqlhosts file directly or through an LDAP server.

    For unsigned applets, however, the host name and the port number or service name of the Informix database server are always required, unless your applet is using the HTTP proxy server. For more information about the HTTP proxy server, see An HTTP proxy server.

  • LOBCACHE=0. Setting the LOBCACHE environment variable to 0 in the database URL specifies that a smart large object is always stored in a file. This setting is not supported for unsigned applets.
Tip: You can enable these features for unsigned applets by using Microsoft™ Internet Explorer, which provides an option to configure the applet permissions.

To access a database on a different host or behind a firewall from an applet, you can use the Informix HTTP proxy servlet in a middle tier. For more information, see An HTTP proxy server.