Example of Accessing the Siebel Java Data Bean

The following example code accesses the Siebel Java Data Bean. You can use a Java IDE to compile and run this code:

import com.siebel.data.*;
import com.siebel.data.SiebelException;

public class DataBeanDemo
{
   private SiebelDataBean m_dataBean = null;
   private SiebelBusObject   m_busObject = null;
   private SiebelBusComp       m_busComp = null;

   public static void main(String[] args)
   {
      DataBeanDemo demo = new DataBeanDemo();
   }

   public DataBeanDemo()
   {
      try
      {
         // instantiate the Siebel Java Data Bean
         m_dataBean = new SiebelDataBean();

         // log in to the Siebel Server
         // SiebelServerhost = the name or IP address of your Siebel Server
         // SCBPort = listening port number for the SCBroker component (default 2321)
         m_dataBean.login("Siebel://SiebelServerhost:SCBPort/enterpriseServer/
          AppObjMgr_enu", CCONWAY, CCONWAY, "enu");

         // get the business object
         m_busObject = m_dataBean.getBusObject("Opportunity");

         // get the business component
         m_busComp = m_busObject.getBusComp("Opportunity");

         // log off
         m_dataBean.logoff();
      }
      catch (SiebelException e)
      {
         System.out.println(e.getErrorMessage());
      }
   }
}