Please enable JavaScript to view this site.

ESL Documentation

Core function

Close a connection.

EDSDisconnect(HDBC_IV ) 

HDBC_IV An input integer value that contains the connection handle.

Description

EDSDisconnect disconnects from a data source, but does not free the connection handle.

Return Values

EDSDisconnect returns EDS_SUCCESS, EDS_ERROR, or EDS_INVALID_HANDLE.

When EDSDisconnect returns EDS_ERROR, you can obtain an associated SQLSTATE value with more specific information by calling EDSError. The following table lists each typical SQLSTATE value and explains each one in the context of the command EDSDisconnect.

The following table lists possible SQLSTATE values.

SQL

STATE

Error

Description

01002

Disconnect error

An error occurred during the disconnect. However, the disconnect succeeded. (Function returns EDS_SUCCESS_WITH_INFO.)

08003

Connection not open

The connection specified in the argument HDBC_IV was not open.

25000

Invalid transaction state

There was a transaction in process on the connection specified by the argument HDBC_IV. The transaction remains active.

IM001

Driver does not support this function

The driver associated with the connection handle does not support the function.

S1000

General error

An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by EDSError in the argument ERRORTEXT describes the error and its cause.

S1001

Memory allocation failure

The driver was unable to allocate the memory required to support execution or completion of the function.

S1010

Function sequence error

An asynchronously executing function was called for an statement handle associated with the connection handle and was still executing when EDSDisconnect was called.

If the ESL application calls EDSDisconnect while there is an incomplete transaction associated with the connection handle, the driver returns SQLSTATE 25000 (Invalid transaction state), indicating that the transaction is unchanged and the connection is open. An incomplete transaction is one that has not been committed or rolled back with EDSTransact.

If your application calls EDSDisconnect before it has freed all statement handles associated with the connection, the driver frees those handles after it successfully disconnects from the data source. However, if one or more of the statement handles associated with the connection are still executing asynchronously, EDSDisconnect will return EDS_ERROR with a SQLSTATE value of S1010 (Function sequence error).

See Also

EDSAllocConnect allocates a connection handle.
EDSConnect connects to a database (the opposite of EDSDisconnect).
EDSDriverConnect connects to a data source using a connection string or dialog box.
EDSFreeConnect releases a connection handle.
EDSTransact executes a commit or rollback operation.