Siebel Object Interfaces Reference > Interfaces Reference > Application Methods >

Login Method


The Login method allows external applications to log in to the COM Data Server, COM Data Control, or Java Data Bean, and to access the Siebel objects. The Login method allows the end user to invoke the Siebel application without being prompted for a login and password. The Login method determines the privileges granted, and the role and responsibility of the end user for that session.

Syntax

Application.Login([connectString,] userName, password)

Argument
Description

connectString

Token-based connect string

userName

Username for login

password

User password for login

Returns

A string containing the error code

Usage

Verify that the Siebel\bin directory is the current directory. To access the Data Control, make sure the default Data Source points to the database that you wish to access and set EnableOLEAutomation to TRUE in your CFG file (this is the default value for the argument).

For information on formatting the connect string, read Connect String.

Used With

COM Data Control, COM Data Server, Java Data Bean

Example

The Connect string for the COM Data Control is token-based; for example:

host = "Siebel://my_computer/SIEBEL/objsrvr/my_computer" lang = "ENU"

Because most languages use quotes to enclose text strings, you must use quotes inside parentheses; for example:

To use the COM Data Control in Visual Basic:

m_dataBean.login("siebel.tcpip.none.none://gateway:gatewayport/enterpriseserver/SCCObjMgr", "username", "password");

To use the COM Data Control in C++:

Login("host=\"siebel//:my_computer/SIEBEL/objsvr/my_computer\" lang = \"ENU\"",""user","password");

The following code sample illustrates how to log in to the server and check for errors.

   Call SiebelAppControl.Login("host=""siebel://gtwy/enterprise/ObjMgr""", "SADMIN", "SADMIN")
   
   //Check for errors
      If SiebelAppControl.GetLastErrCode <> 0 Then
         frmMain.txtStatus.Text = SiebelAppControl.GetLasErrText
      Else
         frmMain.txtStatus.Text = "Connected successfully..."
      End If

The following is a Java Data Bean example that logs into a Siebel Server and then logs off.

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

public class JDBLoginLogoffDemo
{
   private SiebelDataBean m_dataBean = null;
   public static void main(String[] args)
   {
      JDBLoginLogoffDemo demo = new JDBLoginLogoffDemo();
   }

   public JDBLoginLogoffDemo()
   {
      try
      {

         // instantiate the Siebel Data Bean
         m_dataBean = new SiebelDataBean();

         // login to the servers
         m_dataBean.login("siebel.TCPIP.None.None://<gateway>:<port>/<enterprise>/<object manager>","<userid>","<password>");
         System.out.println("Logged in to the Siebel server ");

         //perform function code

         //release the business object

         // logoff
         m_dataBean.logoff();
         System.out.println("Logged off the Siebel server ");
      }

      catch (SiebelException e)
      {
         System.out.println(e.getErrorMessage());
      }
   }
}

Siebel Object Interfaces Reference