Disconnect Method for LCConnection
This method disconnects from a data source. Any existing result set is cleared. For example, this method terminates the connection to DB2® established by the Connect method. Only the connection and state are terminated, in order that reconnection may occur.
A disconnect also happens automatically when the LCConnection object is no longer allocated.
Because disconnecting may involve automatic commit or rollback (depending on the connector type and the settings of the database in question), this method may fail with an error.
Defined In
LCConnection
Syntax
Call lcConnection.Disconnect
Example
Option Public
Uselsx "*lsxlc"
Sub Initialize
Dim connect As New LCConnection ("db2")
' set appropriate properties to connect to DB2
connect.Database = "Gold"
connect.Userid = "JDoe"
connect. Password = "DBINST1"
' connect to DB2 then disconnect
connect.Connect
Print "Successfully connected to DB2."
' now lets disconnect
connect.Disconnect
Print "Successfully disconnected from DB2."
End Sub
Example Output
Successfully connected to DB2.
Successfully disconnected from DB2.