|
Oracle9i Lite Developer's Guide for Java
Release 5.0.2 Part No. B10108-01 |
|
This document introduces the Java interfaces and tools supported by Oracle Lite.
Topics include:
Oracle Lite performs type conversions between Java and Oracle datatypes as indicated by the following table. Table 1-1 lists the Java datatypes and the corresponding SQL datatypes that result from the type conversion.
Table 1-1 Datatype Conversions
| Java Datatype | SQL Datatype |
|---|---|
| byte[], byte[][], Byte[] | BINARY, RAW, VARBINARY |
| boolean, Boolean | BIT |
| String, String[] | CHAR, VARCHAR, VARCHAR2 |
| short, short[], short[][], Short, Short[] | SMALLINT |
| int,int[], int[][], Integer, Integer[] | INT |
| float, float[], float[][], Float, Float[] | REAL |
| double, double[], double[][], Double, Double[] | DOUBLE, NUMBER (without precision) |
| BigDecimal, BigDecimal[] | NUMBER(n) |
| java.sql.Date, java.sql.Date[] | DATE |
| java.sql.Time, java.sql.Time[] | TIME |
| java.sql.Timestamp, java.sql.Timestamp[] | TIMESTAMP |
| java.sql.Connection | Default JDBC connection to database |
Oracle Lite provides tools to manage Java development. Table 1-2 lists these Java tools and their descriptions.
Table 1-2 Java Tools
| Tool | Description |
|---|---|
loadjava
|
Loads Java classes into Oracle Lite. |
dropjava
|
Removes Java classes from Oracle Lite. |
The loadjava utility automates the task of loading Java class and resource files into Oracle Lite. Using loadjava, you can load class and resource files individually, or in ZIP or JAR archives.
After you load the class, create a call specification for the methods in the class that you want to make accessible to SQL statements. To create a call specification for a stored procedure that returns a value, use the SQL CREATE FUNCTION statement. If the stored procedure does not return a value, use the CREATE PROCEDURE statement.
For unloading classes, Oracle Lite provides dropjava, which works similarly to loadjava.
The following tools facilitate Java development for Oracle Lite:
Oracle Developer 2.1 supports user-written Java stored procedures in Oracle Lite.
Oracle JDeveloper also supports Java stored procedures in Oracle Lite, and includes features designed specifically to help develop and deploy Java stored procedures.
This section describes how to set up your development environment to create Oracle Lite applications. To develop Java applications, you must have the Sun Microsystems Java Development Kit (JDK), version 1.3.1 (or higher).
After you install Oracle Lite, set your PATH and CLASSPATH environment variables to enable Oracle Lite to work with the JDK. The PATH and CLASSPATH settings vary depending on which version of the JDK you use, as described in the following sections.
If your environment includes a CLASSPATH user variable before you install Oracle Lite, and the user variable does not include the CLASSPATH system variable (is not specified as CLASSPATH=...;%CLASSPATH%), you must modify the CLASSPATH user variable to include the OLITE40.JAR file in the Oracle_Home\MOBILE\CLASSES directory.
|
Note: All command prompt windows must be closed and reopened to reflect changes made to your CLASSPATH. |
If you are using JDK 1.3.1, the directory with the JDK 1.3.1 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.
Remove oljdk11.jar from the CLASSPATH. This ensures that the version of system classes used by Oracle Lite matches that used by the JDK. For example:
set PATH=c:\JDK_Home\bin;c:\JDK_Home\jre\bin\classic set CLASSPATH=c:\JDK_Home\jrc\lib\rt.jar;c:\Oracle_Home\Mobile\classes\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 follows:
set PATH=c:\jdk1.3.1\bin;c:\jdk1.3.1\jre\bin\hotspot;%PATH%
In the example above, your installation of the JDK and HotSpot is on Drive C, you should verify the location of your installation before ammending your PATH statement. To test whether your system is set up correctly, run the Java examples in the Oracle_Home\Mobile\sdk\Examples\Java directory.
|
![]() Copyright © 2002 Oracle Corporation All rights reserved |
|