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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

while (rset.next()) {// activities is a set of stringsjava.sql.Array activitySet = rset.getArray(2);// Now get and display all the elements of the activity setObject [] allActivities = ((Object [])activitySet.getArray());if (allActivities != null) {// Array.getArray returns null if the database// collection is empty.System.out.println("All Activities for resort " +rset.getString(1));for (int i = 0; i < allActivities.length; i++)System.out.println("\t" + allActivities[i]);}elseSystem.out.println("No activities listed for resort\n" +rset.getString(1));// Now get and display elements 2 thru 4 of the activity set,// but this time use a result set. (start at 2, length of 3)java.sql.ResultSet rsActivity = activitySet.getResultSet(2,3);while (rsActivity.next())System.out.println("Resort " + rset.getString(1) +" has activity " + rsActivity.getString(2) +" in position " + rsActivity.getInt(1) +" of the activities collection attribute\n");}// Clean up workspace storage used by the collectionif (activitySet != null)((ordbCollection)activitySet).free();rset.close();stmt.close();}}<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 64Chapter: 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!