9 Java Application Development

The following sections describe how to develop and test Java applications:

9.1 Java Support for Applications

Table 9-1 lists the Java support provided for each platform in Oracle Database Lite.

Table 9-1 Java Support

Category Web-to-Go (both Windows and Linux) Windows 32 Native Windows CE Linux Native For More Information...

JDBC

Yes

Oracle Database Lite offer three JDBC drivers. Refer to Section 9.1.1, "JDBC Drivers".

Yes

Yes

Yes

On Linux, only JDBC and ODBC access is supported.

Chapter 10, "JDBC Programming"

Java Stored Procedures /Triggers

Yes

Java Stored Procedures/Triggers are not supported in the Web-to-Go application model. However Java Stored Procedures can be replicated using the Consolidator Manager API.

Yes

N/A

Yes

Chapter 11, "Stored Procedures and Triggers"

Java Server Pages

1.1

N/A

N/A

N/A

Section 6.2.3, "Developing JavaServer Pages"

Java Servlet

2.2

N/A

N/A

N/A

Section 6.2.4, "Developing Java Servlets for Web-to-Go" and Section 6.2.7, "Developing Applet Servlet Communication"

BC4J

Yes

Latest version of Oracle JDeveloper 10g.

N/A

N/A

N/A

 

Struts

Yes

N/A

N/A

N/A

 

For programmatically synchronizing from a Java application, see Chapter 3, "Synchronization".

9.1.1 JDBC Drivers

The Oracle Database Lite JDBC driver is JDBC 1.2 compliant. Oracle Lite provides a limited number of extensions specified by JDBC 2.0. These extensions are compatible with the Oracle Database JDBC implementation.

Oracle Database Lite offers the following JDBC drivers:

  • Type 2 driver: There are two types of type 2 driver: one provides an embedded, direct connnection. This driver allows Java applications to communicate directly with the Oracle Lite database. The other type 2 driver provides a remote connection and requires Multi-User service support.

  • Type 4 driver : 100% Java implementation. Requires the multi-user database version.

9.2 Oracle Database Lite Java Development Environment

To develop Java applications, you need to set up your development environment to create Oracle Database Lite applications, as follows:

  • You must have the Sun Microsystems Java Development Kit (JDK), version 1.4.2 (or higher).

  • To enable Oracle Database Lite to work with the JDK, set your PATH and CLASSPATH environment variables after you install Oracle Database Lite. See Section 9.2.1, "Setting Variables for the JDK" for full details.

    Note:

    If your environment includes a CLASSPATH user variable before you install Oracle Database Lite and the user variable does not include the CLASSPATH system variable (is not specified as CLASSPATH=...;%CLASSPATH%), then you must modify the CLASSPATH user variable to include the olite40.jar file in the OLITE_HOME\bin directory.

    Note:

    All command prompt windows must be closed and reopened to reflect changes made to your CLASSPATH.

9.2.1 Setting Variables for the JDK

The directory with the JDK 1.4.2 or 5.0 Java compiler (javac.exe) should be in the PATH variable before any other directories that contain other Java compilers.

Add the directory that contains the Classic Java Virtual Machine (JVM) shared library, jvm.dll, to the PATH. jvm.dll should be in your JDK_Home\jre\bin\classic directory.

For example,

set PATH=C:\JDK_Home\bin;c:\JDK_Home\jre\bin\classic
set CLASSPATH=c:\JDK_Home\jrc\lib\rt.jar;c:\OLITE_HOME\bin\olite40.jar

As an alternative to using the Classic JVM, you can use the HotSpot JVM. HotSpot is a JDK add on module provided by Sun Microsystems. HotSpot is available from the Sun Microsystems Web site.

After installing HotSpot, set your PATH as given below.

set PATH=c:\jdk\bin;c:\jdk\jre\bin\hotspot;%PATH%

In the example above, your installation of the JDK and HotSpot is on Drive C:\. Verify the location of your installation before amending your PATH statement. To test whether your system is set up correctly, run the Java examples in the <ORACLE_HOME>\Mobile\Sdk\Samples\JDBC directory.

9.3 Java Development Tools

To write and debug Java programs, you can use any Java development tool. However, you must ensure that you set the CLASSPATH and PATH correctly.