このメソッドは Connector へのコネクションを確立します。1 つの Connector に複数のコネクションを別々に確立できます。
Lotus® Connector for DB2® の場合、Database、UserName および Password の 3 つのプロパティを指定して DB2 へのコネクションを確立します。
コネクションに失敗するとエラーが発生します。エラーの種類については「エラーメッセージ」を参照してください。
LCConnection
lcConnection.Connect
Option Public
Uselsx "*lsxlc"
Sub Initialize
Dim connect As New LCConnection ("db2")
' set the appropriate properties to connect to DB2
' note the use of dynamic properties to do this
' all properties of a connection may be referenced
' by name
connect.Database = "Gold"
connect.Userid = "JDoe"
connect.Password = "xyzzy"
' try the connect
On error go to Trap
connect.Connect
Print "Successfully connected to DB2."
Exit Sub
Trap:
Print "Connection failed with error " & err & ": " & error
Exit Sub
End Sub
Successfully connected to DB2.