Retrieve data

To retrieve HCL OneDB™ opaque types, you must use ResultSet.getObject(). HCL OneDB JDBC Driver converts the data to a Java™ object according to the custom type map you provide. Using the previous example of the charattrUDT type, you can fetch the opaque data, as in the following example:
String s = "select int_col, charattr_col from charattr_tab order by 1";
System.out.println(s);

Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(s);
System.out.println("execute...ok");

System.out.println("Fetching data ...");
int curRow = 0;
while (rs.next())
        {
        curRow++;
        System.out.println("currentrow=" + curRow + " : ");

        int intret = rs.getInt("int_col");
        System.out.println("   int_col       " + intret);

        charattrUDT charattrret = (charattrUDT)rs.getObject("charattr_col");
        System.out.print("   charattr_col  ");
        if (curRow == 2 || curRow == 6)
                {
                        if (rs.wasNull())
                                System.out.println("<null>");
                        else
                                System.out.println("***ERROR: " + charattrret);
                }
                else
                System.out.println(charattrret+"");
        } //while

System.out.println("total rows expected: " + curRow);
stmt.close();