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.

Working with <strong>Cincom</strong> ORDB objects and object referencesThis section has these subsections:♦ Accessing attribute values♦ Inserting, deleting, and updating database instances♦ Invoking database methodsWithin the <strong>Cincom</strong> ORDB <strong>JDBC</strong> Driver, database object references arerepresented by an instance of a class (or an instance of a subclass) ofordbjava.jdbc.ordbObject.Accessing attribute valuesIn <strong>JDBC</strong>, the java.sql.Ref interface handles the object references. TheordbObject class implements the java.sql.Ref interface allowing generic <strong>JDBC</strong>applications to access and deal with object references without ever importingordbjava.jdbc.ordbObject into the application.The following sample code shows a generic <strong>JDBC</strong> application retrieving thebeach attribute (reference to a seashore object) from class resort, and thenaccessing the description from the seashore reference.Most of the remaining examples in this manual make use of a helperclass named demodbHelper to perform database connections. Thesource for the demodbHelper class is also included in your installation.This sample code may be found in the%ORDB%\demo\jdbc\samples\preparedStmtSample.java file://// This is a simple preparedStatement example//package demo.jdbc.samples;import java.sql.*;import java.math.*;import java.io.*;class preparedStmtSample {public static void main (String args []) throws SQLException{// Connect to the demodb database without autocommit enabled.Connection conn = demodbHelper.makeConnection (args, false);<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 31Chapter: 4. <strong>Cincom</strong> ORDB ExtensionsSection: Working with <strong>Cincom</strong> ORDB objects and object references

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

Saved successfully!

Ooh no, something went wrong!