JDBC Developer's Guide - Supra - Cincom
JDBC Developer's Guide - Supra - Cincom JDBC Developer's Guide - Supra - Cincom
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
- Page 1: SQL ACCESS FOR SUPRASERVER PDM ®JD
- Page 6 and 7: 6. Coding tips and troubleshooting
- Page 8 and 9: What is JDBC?JDBC (Java Database Co
- Page 10: Cincom ORDB extensions to the JDBC
- Page 13 and 14: Checking installed directories and
- Page 15 and 16: Testing JDBC and the database conne
- Page 17 and 18: System.out.println ("Please enter i
- Page 19 and 20: 3. Basic FeaturesIntroductionThis c
- Page 21 and 22: Step 2: Open a connection to a data
- Page 23: Step 5: Process the ResultSet objec
- Page 26 and 27: Cincom ORDB JDBC extension typesAlt
- Page 28 and 29: 4. Cincom ORDB ExtensionsIntroducti
- Page 30 and 31: Class ordbGloThe ordbjava.jdbc.ordb
- Page 32 and 33: prepare a statement that has an inp
- Page 34 and 35: get the first resort referenceordbj
- Page 36 and 37: Invoking database methodsYou can us
- Page 38 and 39: Creating custom Java classes for Ci
- Page 40 and 41: Annotated examples of custom mapped
- Page 42 and 43: The above constructor can be used b
- Page 44 and 45: class jaccommodations.javaThe follo
- Page 46 and 47: public void readSQL(SQLInput stream
- Page 48 and 49: Relating Java classes to database c
- Page 50 and 51: Controlling when custom mapping occ
- Page 52 and 53: Using the getAttributes method of t
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