Insert Objects

From a server-side Java class, you can use the JDBC setObject method to insert an object into a column with Java class data type.

You can insert objects using a prepared statement. For example, the following code fragment inserts an object of type MyJavaClass into a column of table T:

java.sql.PreparedStatement ps = 
    conn.prepareStatement("insert T values( ? )" );
ps.setObject( 1, new MyJavaClass() );
ps.executeUpdate();

An alternative is to set up a SQL variable that holds the object and then to insert the SQL variable into the table.