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.

Inserting, deleting, and updating database instancesWith standard <strong>JDBC</strong>, an application would have to make use of SQL to update,insert, and delete instances of the database.The class ordbjava.jdbc.ordbObject provides methods allowing the applicationdeveloper to insert, delete, and update instances of the database without usingSQL.The following sample code uses the ordbObject extensions to insert a newseashore object, delete an existing seashore instance, and update a resortobject to reference the new seashore.This sample code may be found in the%ORDB%\demo\jdbc\samples\ordbObject.java file://// This example demonstrates the use of the ordbObject methods to// create, delete, and update <strong>Cincom</strong> ORDB database instances.//package demo.jdbc.samples;import java.sql.*;import java.math.*;import java.io.*;class ordbObjectSample {public static void main (String args []) throws SQLException{// Connect to the demodb database without autocommit enabled.Connection conn = demodbHelper.makeConnection (false);// prepare a statement for displaying seashore description of aresortPreparedStatement pstmt = conn.prepareStatement("select beach.description from resort where resort = ?");// Query the first resort object referencesStatement stmt = conn.createStatement ();ResultSet rset = stmt.executeQuery ("SELECT identity FROMresort");<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 33Chapter: 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!