Loading a JDBC driver
For the JdbcSource applet to connect to an external database, a JDBC driver must be loaded locally. This can be done via the applet PARAM tags. The following sample HTML code shows how to specify the driver that the applet loads and how to automate the process by making sure that the driver is automatically loaded.
<APPLET NAME="dataBase1" CODEBASE="..\..\.." CODE="lotus.jdbc.JdbcSource" WIDTH=1 HEIGHT=1>
<PARAM NAME="driver" VALUE="JDBC driver classname">
<PARAM NAME="autoload" VALUE="true">
. . . . MORE APPLET PARAM TAGS . . . . .
</APPLET>
The JdbcSource PARAM tags specify the options for loading the driver.
- The driver PARAM tag specifies the driver that the applet uses for JDBC operations.
- The autoload PARAM tag is set to "true" so that the driver is automatically loaded each time the applet is launched.
The tag option is specified by the NAME attribute and the option value is specified by the VALUE attribute of the tag.
Within the APPLET tag, the various attributes do the following:
- NAME assigns a reference name to the applet so that you can refer to it in your code.
- CODEBASE specifies the base URL of the applet. That is, the directory or folder that contains the applet's code. If this attribute is not specified, then the document's URL is used.
- CODE gives the name of the file that contains the applet's compiled Applet subclass. This file is relative to the base URL of the applet. It cannot be absolute.
- WIDTH and HEIGHT define the size of the applet's display region in the HTML document. This is measured in pixels. In the case of this applet, minimal dimensions are given to the applet so that it remains invisible. You can also achieve the same result by setting the allowUI PARAM tag to "False."