informix
Informix JDBC Driver Programmer's Guide
Sample Code Files

Sample Code Files

This appendix lists and describes the code examples provided with Informix JDBC Driver.

The main examples are located in the following directories:

JDBCLOCATION refers to the directory where you installed Informix JDBC Driver.

Another set of examples is located in the directory $JDBCLOCATION/demo/stores7. A README file in the demo directory explains the various demonstration files and how to execute them.

An RMI example is located in the directory $JDBCLOCATION/demo/rmi. A README file in the demo directory explains how to execute the example.

Example output files of the ClassGenerator utility are located in the directory $JDBCLOCATION/demo/tools/classgenerator. A README file in the classgenerator directory explains how to use the example.

The main examples are located in the following directories:

JDBCLOCATION refers to the directory where you installed Informix JDBC Driver.

Another set of examples is located in the directory %JDBCLOCATION%\demo\stores7. A README file in the demo directory explains the various demonstration files and how to execute them.

An RMI example is located in the directory %JDBCLOCATION%\demo\rmi. A README file in the demo directory explains how to execute the example.

Example output files of the ClassGenerator utility are located in the directory %JDBCLOCATION%\demo\tools\classgenerator. A README file in the classgenerator directory explains how to use the example.

The following table lists the files in the basic directory. For each code example, the table displays the name of the Java program and a brief description of what the program does.

Demo Program Name Description
autofree.java Shows how to use the AUTOFREE environment variable.
BatchUpdate.java Shows how to send batch updates to the server.
ByteType.java Shows how to insert into and select from a table that contains a column of data type BYTE.
CreateDB.java Creates a database called testDB.
DBCENTURYSelect.java Shows how to retrieve a date string representation that has a four-digit year expansion based on the DBCENTURY property value from the URL string.
DBConnection.java Creates connections to both a database and a database server.
DBDATESelect.java Shows how to retrieve a date object and a date string representation from the database based on the DBDATE property value from the URL string.
DBMetaData.java Shows how to retrieve information about a database with the DatabaseMetaData interface.
DropDB.java Drops a database called testDB.
GLDATESelect.java Shows how to retrieve a date object and a date string representation from the database based on the GL_DATE property value from the URL string.
Intervaldemo.java Shows how to insert and select Informix interval data.
LOCALESelect.java Shows how to retrieve a date object and a date string representation from the database based on the CLIENT_LOCALE property value from the URL string.
MultiRowCall.java Shows how to return multiple rows in a stored procedure call.
OptimizedSelect.java Shows how to use the FET_BUF_SIZE environment variable to adjust the Informix JDBC Driver tuple buffer size.
optofc.java Shows how to use the OPTOFC environment variable.
PropertyConnection.java Shows how to specify connection environment variables via a property list.
RSMetaData.java Shows how to retrieve information about a result set with the ResultSetMetaData interface.
ScrollCursor.java Shows how to retrieve a result set with a scroll cursor.
Serial.java Shows how to insert and select Informix SERIal and SERIal8 data.
SimpleCall.java Shows how to call a stored procedure.
SimpleConnection.java Shows how to connect to a database or database server.
SimpleSelect.java Shows how to send a simple SELECT query to the database server.
TextConv.java Shows how to convert a file from the client code set to Unicode and then from Unicode to the database code set.
TextType.java Shows how to insert into and select from a table that contains a column of data type TEXT.

The following table lists the files in the clob-blob directory. For each code example, the table displays the name of the Java program and a brief description of what the program does.

Demo Program Name Description
demo1.java Shows how to create two tables with BLOB and CLOB columns and compare the data.
demo2.java Shows how to create one table with BYTE and TEXT columns and a second table with BLOB and CLOB columns and how to compare the data.
demo3.java Shows how to create one table with BLOB and CLOB columns and a second table with BYTE and TEXT columns and how to compare the data.
demo4.java Shows how to create two tables with BYTE and TEXT columns and compare the data.
demo5.java Shows how to store data from a file into a BLOB table column.
demo6.java Shows how to read a portion of the data in a smart large object.
demo_11.java Shows how to read data from a file into a buffer and write the contents of the buffer into a smart large object.
demo_13.java Shows how to write data into a smart large object and then insert the smart large object into a table.
demo_14.java Shows how to fetch smart large object data from a table.

The following table lists the files in the udt-distinct directory. For each code example, the table displays the name of the Java program and a brief description of what the program does.

Demo Program Name Description
charattrUDT.java Shows how to implement an opaque fixed-length type using SQLData.
createDB.java Creates a database that the other udt-distinct demonstration files use.
createTypes.java Shows how to create opaque and distinct types in the database.
distinct_d1.java Shows how to create a distinct type without using SQLData.
distinct_d2.java Shows how to create a second distinct type without using SQLData.
dropDB.java Drops the database that the other udt-distinct demonstration files use.
largebinUDT.java Shows how to implement an opaque type (smart large object embedded) using SQLData.
myMoney.java Shows how to implement a distinct type using SQLData.
udt_d1.java Shows how to create a fixed-length opaque type.
udt_d2.java Shows how to create an opaque type (smart large object embedded).

The following table lists the files in the complex-types directory. For each code example, the table displays the name of the Java program and a brief description of what the program does.

Demo Program Name Description
createDB.java Creates a database with named rows.
list1.java Inserts and selects a simple collection using both the java.sql.Array and java.util.Collection classes. <