JDBC Developer's Guide - Supra - Cincom
JDBC Developer's Guide - Supra - Cincom JDBC Developer's Guide - Supra - Cincom
Example using the Array as input parameterString resortName = "newResort";PreparedStatement stmt =conn.prepareStatement("insert into" +" resort(name,activities) values(?, ?)");stmt.setString(1, resortName);stmt.setArray(2, newActivities);stmt.executeUpdate();stmt.close();// display the new resort activitiesStatement stmt1 = conn.createStatement();rs = stmt1.executeQuery("select a.activity from " + "resort,table(activities) as a(activity)" +" where name = 'newResort'");System.out.println("activities in newResort follow:");while (rs.next())System.out.println(rs.getString(1));rs.close();stmt1.close();stmt.close();// Clean up Cincom ORDB workspace storage used by the collectionif (newActivities != null)newActivities.free();// close the connectionconn.close();}}JDBC Developer's Guide, P25-9504-03 Page 72Chapter: 4. Cincom ORDB ExtensionsSection: Working with Cincom ORDB collections
Collections and custom mappingBy default, the getArray methods of the java.sql.Array interface (implementedby ordbCollection) will return database object references as type java.sql.Ref.The static method ordbCollection.setAutoPerformCustomMapping can be usedto indicate whether getArray should perform custom mapping on databasereferences. The following example shows both behaviors. This sample can befound in the %ORDB%\demo\jdbc\samples\collectionSample5.java file:package demo.jdbc.samples;import java.sql.*;import java.math.*;import java.io.*;import ordbjava.jdbc.*;import java.util.HashMap;//import for custom mappingclass collectionSample5{public static void main (String args []) throws SQLException{// Connect to the demodb database without autocommit enabled.Connection conn = demodbHelper.makeConnection (false);Statement stmt = conn.createStatement();// Build a type map to relate java class jseashore to database class// seashore.try{conn.getTypeMap().put("seashore",Class.forName("demo.jdbc.samples.jseashore"));} catch(ClassNotFoundException e){System.out.println("***Caught SQLException: " + e.getMessage());}JDBC Developer's Guide, P25-9504-03 Page 73Chapter: 4. Cincom ORDB ExtensionsSection: Working with Cincom ORDB collections
- 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
- Page 54 and 55: 13 activities// 14 sounds_of_the_ca
- Page 56 and 57: }Statement stmt = conn.createStatem
- Page 58 and 59: In the previous example, the applic
- Page 60 and 61: ♦writeSQL() method. You must impl
- Page 62 and 63: Retrieving a collection and its ele
- Page 64 and 65: while (rset.next()) {// activities
- Page 66 and 67: ordbCollection rooms = null;while (
- Page 68 and 69: public static void main (String arg
- Page 70 and 71: insertValue(Object javaObj, int JDB
- Page 74 and 75: create a new collection of seashore
- Page 76 and 77: 5. Cincom ORDB JDBC NotesIntroducti
- Page 78 and 79: ConnectionThe database does not sup
- Page 80 and 81: PreparedStatementCincom ORDB JDBC D
- Page 82 and 83: Cincom ORDB JDBC Driver does not su
- Page 84 and 85: SQLOutputThe Cincom ORDB JDBC Drive
- Page 86 and 87: JDBC and multi-threadingThe Cincom
- Page 88 and 89: Example: Disabling AutoCommit. The
- Page 90 and 91: setConnectPoolTimeout(long millisec
- Page 92 and 93: Logging JDBC callsThe Cincom ORDB J
- Page 94 and 95: Accessing JDBC samplesUse one of th
- Page 96 and 97: IndexAaccesing attribute values,exa
- Page 98: RResultSet objectclosing 23processi
Collections and custom mappingBy default, the getArray methods of the java.sql.Array interface (implementedby ordbCollection) will return database object references as type java.sql.Ref.The static method ordbCollection.setAutoPerformCustomMapping can be usedto indicate whether getArray should perform custom mapping on databasereferences. The following example shows both behaviors. This sample can befound in the %ORDB%\demo\jdbc\samples\collectionSample5.java file:package demo.jdbc.samples;import java.sql.*;import java.math.*;import java.io.*;import ordbjava.jdbc.*;import java.util.HashMap;//import for custom mappingclass collectionSample5{public static void main (String args []) throws SQLException{// Connect to the demodb database without autocommit enabled.Connection conn = demodbHelper.makeConnection (false);Statement stmt = conn.createStatement();// Build a type map to relate java class jseashore to database class// seashore.try{conn.getTypeMap().put("seashore",Class.forName("demo.jdbc.samples.jseashore"));} catch(ClassNotFoundException e){System.out.println("***Caught SQLException: " + e.getMessage());}<strong>JDBC</strong> <strong>Developer's</strong> <strong>Guide</strong>, P25-9504-03 Page 73Chapter: 4. <strong>Cincom</strong> ORDB ExtensionsSection: Working with <strong>Cincom</strong> ORDB collections