The JDBCExamples.java class contains three methods that illustrate distributed Java computing. These are all called from the main method. This method is called in the connection example described in “Connecting from a JDBC client application using jConnect”, and is an example of a distributed application.
Here is the getObjectColumn method from the JDBCExamples class.
private static void getObjectColumn() throws Exception { // Return a result set from a column containing // Java objects asademo.ContactInfo ci; String name; String sComment ; if ( conn != null ) { Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT JContactInfo FROM jdba.contact" ); while ( rs.next() ) { ci = ( asademo.ContactInfo )rs.getObject(1); System.out.println( "\n\tStreet: " + ci.street + "City: " + ci.city + "\n\tState: " + ci.state + "Phone: " + ci.phone + "\n" ); } } }
The getObject method is used in the same way as in the internal Java case.