Storing Java objects as column data in a table

Some database products enable you to directly store Java objects as column data in a database. In such databases, Java classes are treated as datatypes, and you can declare a column with a Java class as its datatype.

jConnect supports storing Java objects in a database by implementing the setObject methods defined in the PreparedStatement interface and the getObject methods defined in the CallableStatement and ResultSet interfaces. This allows you to use jConnect with an application that uses native JDBC classes and methods to directly store and retrieve Java objects as column data.

NoteTo use getObject and setObject, set the jConnect version to com.sybase.jdbcx.SybDriver.VERSION_4 or later. See “Using JCONNECT_ VERSION”.

The following sections describe the requirements and procedures for storing objects in a table and retrieving them using JDBC with jConnect:

Note Adaptive Server version 12.0 and later and SQL Anywhere version 6.0.x and later can store Java objects in a table, with some limitations. See the jConnect for JDBC Release Bulletin for more information.