Prebinding example

The following code from the udt_bindCol.java sample program prebinds an opaque type to the HCL Informix® VARCHAR and then to a standard Java™ Integer type. The table used in this example has one int column and one opaque type column and is defined as follows:
create table charattr_tab (int_col int, charattr_col charattr_udt)
The code to select and prebind the opaque type in the charattr_col column is as follows:
String s = "select int_col, charattr_col as cast_udt_to_lvc, " +
    "charattr_col as cast_udt_to_int from charattr_tab order by 1";

pstmt = conn.prepareStatement(s);
    ((IfxPreparedStatement)pstmt).setBindColIfxType(2,IfxTypes.IFX_TYPE_LVARCHAR);
    ((IfxPreparedStatement)pstmt).setBindColType(3,Types.INTEGER);

ResultSet rs = pstmt.executeQuery();

System.out.println("Fetching data ...");
int curRow = 0;
while (rs.next())
{
     curRow++;
     int intret = rs.getInt("int_col");
     String strret = rs.getString("cast_udt_to_lvc");
     int intret2 = rs.getInt("cast_udt_to_int");
} // end while