Chapter 3. Applet Database Connections
In this chapter, we’ll explore issues that are specific to using JDBC with applets. We’ll begin by asking the question: “What type of JDBC driver supports an applet, and for which versions of the JDK?” Then we’ll talk about other things you need to know, such as the life cycle of an applet, when to open and close a database connection, how to package an applet that uses Oracle JDBC classes, how to deal with the restrictions placed on JDBC connections by the secure environment of your browser’s JVM, and how to connect through a firewall.
Oracle Drivers and JDK Versions
For applets, you have only one driver choice:
the client-side Thin driver. Since it’s a 100% pure Java
driver, you can package it with your applet’s archive so
it’s downloaded by the browser along with your applet.
I’ll discuss how to package the Thin driver with your applet
later in this chapter. For now, just keep in mind as we go along that
you’ll need to package the appropriate
classesXXX.zip file with your applet, and
you’ll be using the Thin database URL syntax discussed in Chapter 2.
As of Oracle8i Version 8.1.6, JDK 1.0.x is no longer supported by Oracle. Instead, Oracle8i now supports only JDK Versions 1.1.x and 1.2.x. Table 3-1 lists the support files you need to package with your applet to support each of these versions.
Table 3-1. JDBC support files
|
JDK version |
JDBC classes |
National Language Support classes |
|---|---|---|
|
JDK 1.1.x |
|
|
|
JDK 1.2.x ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access