Try OpenEdge Now
skip to main content
Java Open Clients
Using SmartDataObjects from Java Clients : Accessing remote SmartDataObjects from Java : Example Java access to a SmartDataObject
 

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", as shown:
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 SDOResultSet 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 ABL 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.