JDBC Developer's Guide - Supra - Cincom

JDBC Developer's Guide - Supra - Cincom JDBC Developer's Guide - Supra - Cincom

10.07.2015 Views

Contents1. Overview ................................................................................ 7Introduction ................................................................................................ 7What is JDBC? .............................................................................................. 8Basic driver architecture ................................................................................. 9Cincom ORDB extensions to the JDBC standard .................................................... 10Supported JDK and JDBC versions .................................................................... 112. Verifying a JDBC Driver installation ............................................. 12Introduction .............................................................................................. 12Checking installed directories and files ............................................................. 13Directories for JDBC ............................................................................... 13Check the environment variables ..................................................................... 14Determining the version of the JDBC Driver ................................................... 14Testing JDBC and the database connection .................................................... 15Running the jdbcHelloWorld.java program..................................................... 153. Basic Features ........................................................................ 19Introduction .............................................................................................. 19First steps in JDBC ...................................................................................... 20Step 1: Register the JDBC Driver ................................................................ 20Step 2: Open a connection to a database ..................................................... 21Step 3: Create a Statement object ............................................................. 21Step 4: Execute a query and return a ResultSet object ..................................... 22Step 5: Process the ResultSet object ........................................................... 23Step 6: Close the ResultSet and Statement Objects ......................................... 23Step 7: Close the Connection .................................................................... 23Sample: Connecting, querying, and processing the results ....................................... 24Datatype mappings ...................................................................................... 25Cincom ORDB JDBC extension types ............................................................. 26Error Messages and JDBC ............................................................................... 27JDBC Developer's Guide, P25-9504-03 4Contents

4. Cincom ORDB Extensions ........................................................... 28Introduction .............................................................................................. 28Classes of the ordbjava.jdbc package ............................................................... 28Class ordbDriver .................................................................................... 29Class ordbObject ................................................................................... 29Class ordbGlo ....................................................................................... 30Class ordbCollection ............................................................................... 30Working with Cincom ORDB objects and object references ...................................... 31Accessing attribute values ........................................................................ 31Inserting, deleting, and updating database instances ........................................ 33Invoking database methods ....................................................................... 36Creating custom Java classes for Cincom ORDB objects .......................................... 38Generating Java classes from a database schema ............................................ 39Generating Java classes with the CustomMappingDlg class ................................. 39Annotated examples of custom mapped classes .............................................. 40Relating Java classes to database class names ................................................ 48Controlling when custom mapping occurs ...................................................... 50Inserting, deleting, and updating with custom mapping ..................................... 55Writing your own custom mapping classes ..................................................... 58Working with Cincom ORDB collections .............................................................. 61Retrieving a collection and its elements ....................................................... 62Working with heterogeneous collections ....................................................... 65Homogeneous collections and Java primitive arrays ......................................... 67Creating and modifying collections .............................................................. 69Collections and custom mapping................................................................. 73Freeing Cincom ORDB workspace storage used by ordbCollections ........................ 755. Cincom ORDB JDBC Notes .......................................................... 76Introduction .............................................................................................. 76Supported JDBC 3.0 interfaces ........................................................................ 77Array .................................................................................................. 77Blob ................................................................................................... 77Clob ................................................................................................... 77Connection .......................................................................................... 78DatabaseMetaData ................................................................................. 79Driver ................................................................................................. 79PreparedStatement ................................................................................ 80Ref .................................................................................................... 80ResultSet ............................................................................................. 81ResultSetMetaData ................................................................................. 83SQLInput ............................................................................................. 83SQLOutput ........................................................................................... 84Statement ........................................................................................... 84Struct ................................................................................................. 84JDBC Developer's Guide, P25-9504-03 5Contents

4. <strong>Cincom</strong> ORDB Extensions ........................................................... 28Introduction .............................................................................................. 28Classes of the ordbjava.jdbc package ............................................................... 28Class ordbDriver .................................................................................... 29Class ordbObject ................................................................................... 29Class ordbGlo ....................................................................................... 30Class ordbCollection ............................................................................... 30Working with <strong>Cincom</strong> ORDB objects and object references ...................................... 31Accessing attribute values ........................................................................ 31Inserting, deleting, and updating database instances ........................................ 33Invoking database methods ....................................................................... 36Creating custom Java classes for <strong>Cincom</strong> ORDB objects .......................................... 38Generating Java classes from a database schema ............................................ 39Generating Java classes with the CustomMappingDlg class ................................. 39Annotated examples of custom mapped classes .............................................. 40Relating Java classes to database class names ................................................ 48Controlling when custom mapping occurs ...................................................... 50Inserting, deleting, and updating with custom mapping ..................................... 55Writing your own custom mapping classes ..................................................... 58Working with <strong>Cincom</strong> ORDB collections .............................................................. 61Retrieving a collection and its elements ....................................................... 62Working with heterogeneous collections ....................................................... 65Homogeneous collections and Java primitive arrays ......................................... 67Creating and modifying collections .............................................................. 69Collections and custom mapping................................................................. 73Freeing <strong>Cincom</strong> ORDB workspace storage used by ordbCollections ........................ 755. <strong>Cincom</strong> ORDB <strong>JDBC</strong> Notes .......................................................... 76Introduction .............................................................................................. 76Supported <strong>JDBC</strong> 3.0 interfaces ........................................................................ 77Array .................................................................................................. 77Blob ................................................................................................... 77Clob ................................................................................................... 77Connection .......................................................................................... 78DatabaseMetaData ................................................................................. 79Driver ................................................................................................. 79PreparedStatement ................................................................................ 80Ref .................................................................................................... 80ResultSet ............................................................................................. 81ResultSetMetaData ................................................................................. 83SQLInput ............................................................................................. 83SQLOutput ........................................................................................... 84Statement ........................................................................................... 84Struct ................................................................................................. 84<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 5Contents

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

Saved successfully!

Ooh no, something went wrong!