Zurück

New Features JDBC 2.0 introduced by SUN


The Basic JDBC 2.0 and Advanced Samples demonstrate the usage of various new features introduced in JDBC Specification defined by Sun Microsystems.

This Samples have been published on Oracle Technet in August 2002.

You can download the JAR-Files including all Sources and Readme files if you click on the appropriate headline below.


Basic JDBC 2.0 Samples

This sample application demonstrates how to invoke PLSQL Stored Procedures from the database using JDBC APIs. Oracle JDBC drivers support execution of PL/SQL stored procedures from java applications.

This sample shows how to access DATE datatype columns from Java using JDBC APIs.

This sample application demonstrates how to perform basic SQL operations like SELECT, INSERT, UPDATE, and DELETE from a java application using JDBC APIs.

This sample application demonstrated how to retrieve and process a REFCURSOR from a java application using JDBC APIs. The sample creates a PLSQL Function that returns a REFCURSOR. This PLSQL Function is invoked from the application and the REFCURSOR returned by the function is processed using JDBC APIs.

This sample application illustrates how to access database rows through its ROWID from a java application. ROWIDs can be accessed either as a string, or as a oracle.sql.ROWID type using the JDBC APIs. The application times the query of a row using the ROWID, and also using the primary key column of the table.

This application shows how to perform the data manipulation on a LONG column of a database table from a java application using JDBC APIs. To access the data in a LONG column, you can get the column as a java InputStream and use the read() method of the InputStream object.

This sample application demonstrates how to perform the data manipulation on a LONGRAW column of a database table from a java application using JDBC APIs.

This sample application demonstrates how to access Varchar2 and Char columns of a database table using JDBC APIs.

JDBC Advanced Samples

An external file, or BFILE, is used to store a locator to a file outside the database, stored somewhere on the filesystem of the data server. The locator points to the actual location of the file. This sample application demonstrates how to manipula the BFile column type of a database table.

Oracle JDBC drivers enable you to inform the driver of the types of the columns in an upcoming query, saving a round trip to the database that would otherwise be necessary to describe the table.This application illustrates the Column-Type Specification performance extension of Oracle JDBC drivers.

This application shows how to create and execute dynamic sql queries using JDBC. The user selects a table from his schema, then the columns and provides the where clause. The dynamic SQL query is then formed based on the user input and executed.

This sample illustrates mapping of columns retrieved from the database to native java data types like String, int, float etc. using JDBC APIs. JDBC provides methods like getString() and getInt(), which are used to convert oracle data types like VARCHAR2 and NUMBER, to java data types like String and int. The sample retrieves NUMBER and VARCHAR2 columns as int, float and String values.

The term large object (LOB) refers to a data item that is too large to be stored directly in a database table. Thi s sample application demonstrates how to read and write LOB datatype.The Oracle JDBC drivers provide support for two types of LOBs: BLOBs (unstructured binary data) and CLOBs (character data). 'BLOB and CLOB data is accessed and referenced using a locator stored in the database table.

This sample illustrates oracle.sql mapping to retrieve data from the Oracle database. This sample actually converts the data types of oracle database into oracle.sql data types.

This sample illustrates the use of threads in a JDBC application. By using threads in a typical java application which performs database access and data processing, one can improve performance by having two threads, one performing data access, and other handling the processing of data simultaneously.

The row-prefetching feature associates an integer row-prefetch setting with a given statement object. JDBC fetches that number of rows at a time from the database during the query to get better performance. This sample illustrates how to set the row prefetch size value using JDBC APIs.

This sample illustrates how data can be accessed as streams in JDBC. Using JDBC stream data can be read in various formats like Unicode, Binary and Ascii.