New Method for LCConnection

This is the constructor for objects of class LCConnection.

Defined In

LCConnection

Syntax

Dim connectionName As New LCConnection(libraryName) ' DECS only

or

Dim connectionName As New LCConnection(ConnectionDocumentName) ' HEI Scripted Activity agents only

Parameters

Parameter

Description

libraryName

The name of a valid, installed connector, such as DB2® or Oracle, and the db2.lcx or oracle.lcx exists in the Domino® Directory. A metaconnector name may also be used (order, meter, and so on).

Note: Use lowercase letters for libraryName, as some file systems are case-sensitive. See the LCSession.ListConnectors method, which is used to determine the installed connectors.

ConnectionDocumentName

The name of a valid connection document that exists in the HEI Administrator.

Usage Notes®

The following considerations are helpful when working with the New method for LCConnection.

  • A connection library is located by file name. The files are located in the Notes® executable directory and use the suffix ".dcx".
  • When the HEI server executes a Scripted Activity, it calls a LotusScript® agent in your Notes® database. When you use the New method of LCConnection in this context, it expects you to supply a the name of connection document in the HEI Administrator database (decsadm.nsf); you may not supply a connector name. All of the properties of the connection - Server, UserID, Password, Metadata, and so on - are filled in based on the information in this connection document. You can then change these properties. For example, change the Metadata property if you need to use a different table than the one specified in the connection document.
  • In all cases except Scripted Activity agents, the constructor argument specifies a connector or Metaconnector. Base connectors are delivered with HCL Enterprise Integrator (HEI) and or Domino®; others can optionally be purchased or you can use the LC APIs to write your own. See the Connectors and Connectivity Guide at http://www.ibm.com/developerworks/lotus/documentation/lei/ for details.
  • If you use a Metaconnector, you will have to supply the actual connection name in the ConnectorName property. The examples demonstrate this.
  • The constructor allocates a numeric code for this connection, unique among all connections, which can be used as a virtual code for a field (see LCField.SetVirtualCode). This value can be retrieved as the property LCTOKEN_CONNECTION_CODE. There is also a numeric virtual code for the type of connection (for example, DB2®), available in the LCTOKEN_CONNECTOR_CODE property. You can use this code when merging fieldlists to separate out those fields associated with a particular connection or connector. See the LCFieldlist.MergeVirtual method for details.

Example

' DECS only
Dim MyNewConnectionName as New LCConnection("oracle") 
 
' HEI scripted agents only
Dim MyNewConnection as New LCConnection("OracleConnDoc")

' with the "order" metaconnector
Option Public
Option Declare
Uselsx "*lsxlc"
Sub Initialize
	Dim birthdayTable As New LCConnection("order")
	Dim flds As New LCFieldList
	Dim i As Integer
	
	With birthdayTable
		.ConnectorName = "db2"
		.Database = "STATS" ' local database, no userid.
		.Metadata = "BIRTHDAYS"
		.OrderNames = "BIRTH_DATE" ' order metaconnector will sort by this field.
		.Connect
		.Select Nothing, 1, flds
		Do While birthdayTable.Fetch(flds)
			For i = 1 To flds.FieldCount
				Print flds.GetName(i) & " = " & flds.GetField(i).Text(0)
			Next
		Loop
	End With
End Sub

Example Output

FIRSTNAME = Anapest
LASTNAME = Jones
BIRTH_DATE = 04/03/1901
FIRSTNAME = Ozymandias
LASTNAME = Miller
BIRTH_DATE = 02/20/1979
FIRSTNAME = Chlorine
LASTNAME = Foss
BIRTH_DATE = 09/01/1980