10.07.2015 Views

JDBC Developer's Guide - Supra - Cincom

JDBC Developer's Guide - Supra - Cincom

JDBC Developer's Guide - Supra - Cincom

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Working with heterogeneous collectionsThe java.sql.Array interface assumes that all elements in the array have thesame domain. Since <strong>Cincom</strong> ORDB collections can be heterogeneous, theordbCollection class provides additional methods for dealing withheterogeneous collections. These methods are:♦♦♦isHomogeneous() - Returns true if the elements of the database collectionare of the same domain.getBaseType(int index) - Returns the <strong>JDBC</strong> type (from java.sql.Types) ofthe specified element. (The first collection element is at index 1.)getBaseTypeName(int index) - Returns the database domain string for thespecified element.The following example demonstrates these methods and can be found in the%ORDB%\demo\jdbc\samples\collectionSample2.java file://// This example demonstrates the use of ordbCollection methods to deal// with heterogeneous <strong>Cincom</strong> ORDB collections.//package demo.jdbc.samples;import java.sql.*;import java.math.*;import java.io.*;import ordbjava.jdbc.*;import java.util.HashMap;//import for custom mappingclass collectionSample2 {public static void main (String args []) throws SQLException{// Connect to the demodb database without autocommit enabled.Connection conn = demodbHelper.makeConnection (false);/* select a heterogeneous set */Statement stmt = conn.createStatement ();ResultSet rset = stmt.executeQuery ("SELECT name, rooms FROM resort");<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 65Chapter: 4. <strong>Cincom</strong> ORDB ExtensionsSection: Working with <strong>Cincom</strong> ORDB collections

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!