Progress
Open Client
Developer’s Guide


Example Java Access To a SmartDataObject

The following example application connects to the default AppServer and Application Service using an SDOAppObject, which is a prebuilt AppObject installed with Open Client Toolkit. It then accesses the SmartDataObject, CustSDO.w, as an SDOResultSet and changes the name of customer number 1 to "John".

Java Client Using an SDOAppObject
import com.progress.open4gl.*;

public class Sample1
{
   public static void main(String args[]) throws Exception   {
      // Create an SDOAppObject and connect to the AppServer
      SDOAppObject appObj = new SDOAppObject ();

      // Create an SDOResultSet object
      com.progress.open4gl.SDOResultSet rSet =   
            appObj._createSDOResultSet("CustSDO.w");

      rSet.first(); // Position on the first customer
      rSet.updateString("Name", "John"); // Modify the name to "John"
      rSet.updateRow(); // Send the new value to the AppServer

      // Close the SDO object. 
      rSet.close();

      // release the AppObject
      appObj._release();
   }
} 

This SDOResultSet object extends the JDBC 1 ResultSet interface to include JDBC 2 functionality. Thus, using standard JDBC 2 ResultSet methods on an SDOResultSet object, you can access Progress data provided by the specified SmartDataObject in the same way as a standard JDBC 2 ResultSet. SDOResultSet also further extends JDBC 2 functionality to access the unique capabilities of SmartDataObjects.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095