Bookshelf Home | Contents | Index | Search | PDF |
Siebel Object Interfaces Reference > Programming > Getting Started with the Siebel Object Interfaces >
Instantiating the Siebel COM Data Server
Because the Siebel COM Data Server acts without the regular Siebel eBusiness Application User Interface, you must use the Login method to set up your Data Server object. You cannot use methods that retrieve active Siebel objects, because there are no current active Siebel objects. You must instantiate your own Siebel objects. Calls made to the Siebel COM Data Server are in process.
If you use Microsoft Visual Basic 5.0 or later, the required support file,
sobjsrv.tlb
, must be in the same directory as the CFG file you are using for your Siebel application, or the COM Data Server does not work. Take the following steps to make sure you are referring to the correct library.NOTE: Do not run in the Microsoft VB Debug environment when communicating with the Siebel COM data server.
To set up Microsoft Visual Basic to access the Siebel COM Data Server
- Start Microsoft Visual Basic.
- Select Standard EXE.
- Choose Project > References.
- In the list box, select (but do not check) Siebel Data BusObject Interfaces. Near the bottom of the dialog box, note the directory in which the file sobjsrv.tlb resides, as shown in the following illustration.
- Check the Siebel Data BusObject Interfaces entry and click OK.
The following is sample code for the Siebel COM Data Server. Make sure that the DataSource parameter in the CFG file is set to the database to which you want to connect.
NOTE: This code must be written and executed outside of Siebel Tools, for example in Microsoft Visual Basic.
Private Sub Command1_Click()
'Siebel Application Object
Dim siebApp As SiebelApplication
Dim siebBusObj As SiebelBusObject
Dim siebBusComp As SiebelBusComp
Dim siebSvcs As SiebelService
Dim siebPropSet As SiebelPropertySet
Dim bool As Boolean
Dim errCode As Integer
Dim errText As String
Dim connStr As String
Dim lng As String
Dim cfgLoc As StringChDrive "D:"
ChDir "D:\Server\siebsrvr\bin "'Create The COM Data Server Object
Set siebApp = CreateObject("SiebelDataServer.ApplicationObject")If Not siebApp Is Nothing Then
'''COM Data Server
cfgLoc = " D:\Server\siebsrvr\bin \ENU\siebel.cfg,ServerDataSrc"
siebApp.LoadObjects cfgLoc, errCode
If errCode = 0 Then
'Log Into the Siebel Server
siebApp.Login "username", "password", errCode
If errCode = 0 Then
'Creat A Business Object
Set siebBusObj = siebApp.GetBusObject("Contact", errCode)
If errCode = 0 Then
'Create a Business Component
Set siebBusComp = siebBusObj.GetBusComp("Contact")
Else
errText = siebApp.GetLastErrText
TheApplication().RaiseErrorText("Business Object Creation failed: " & errCode & "::" & errText);
End If'Create A New Property Set
Set siebPropSet = siebApp.NewPropertySet(errCode)
If errCode = 0 Then
Set siebPropSet = Nothing
Else
errText = siebApp.GetLastErrText
TheApplication().RaiseErrorText("Property Set Creation failed: " & errCode & "::" & errText);
End If'Get A Siebel Service
Set siebSvcs = siebApp.GetService("Workflow Process Manager", errCode)
If Not siebSvcs Is Nothing Then
Set siebSvcs = Nothing
Else
errText = siebApp.GetLastErrText
TheApplication().RaiseErrorText("Could not Get Siebel Service: " & errCode & "::" & errText);
End IfIf Not siebBusComp Is Nothing Then
Set siebBusComp = Nothing
End If
If Not siebBusObj Is Nothing Then
Set siebBusObj = Nothing
End If
Else
errText = siebApp.GetLastErrText
TheApplication().RaiseErrorText("Login Failed: " & errCode & "::" & errText);
End If
Else
errText = siebApp.GetLastErrText
TheApplication().RaiseErrorText("Load Objects Failed: " & errCode & "::" & errText);
End IfSet siebApp = Nothing
End If
End Sub
Bookshelf Home | Contents | Index | Search | PDF |
Siebel Object Interfaces Reference Published: 18 June 2003 |