High Level subroutine
Connect to a data source and return environment, connection, and statement handles.
call EDSInit(HENV_IV,HDBC_IV,HSTMT_IV,DSN_SV,UID_SV,PASSWORD_SV)
•HENV_IV An output integer value indicating the environment handle
•HDBC_IV An output integer value indicating the connection handle.
•HSTMT_IV An output integer value indicating the statement handle.
•DSN_SV A string input value that contains the data source name.
•UID_SV A string input value that contains the user identifier.
•PASSWORD_SV A string input value that contains the authentication string (typically the password).
Description
EDSInit makes the EDS allocation function calls EDSAllocEnv, EDSAllocConnect, and EDSAllocStmt and the connection call EDSConnect. It will therefore return an environment handle, a connection handle, and a single statement handle to an active connection. This allows the you to call one command when the user wishes to establish a connection to a data source.
You can call this command multiple times in one session. Each time it is called, a new connection is established and a statement handle is allocated on the previously established environment handle.
Return Values
EDSInit returns EDS_SUCCESS, EDS_SUCCESS_WITH_INFO, EDS_INVALID_HANDLE, EDS_MAX_HANDLES, or EDS_ERROR.
When EDSInit 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 EDSInit.
The following table lists possible SQLSTATE values:
SQL STATE |
Error |
Description |
08001 |
Unable to connect to data source |
The driver was unable to establish a connection with the data source. |
08002 |
Connection in use. |
The specified connection handle had already been used to establish a connection with a data source and the connection was still open. |
08003 |
Connection not open |
The connection specified by the HDBC_IV argument was not open. The connection process must be completed successfully (and the connection must be open) for the driver to allocate a statement handle. |
08004 |
Data source rejected establishment of connection |
The data source rejected the establishment of the connection for implementation-defined reasons. |
08S01 |
Communication link failure |
The communication link between the driver and the data source to which the driver was attempting to connect failed before the function completed processing. |
28000 |
Invalid authorization specification |
The value specified for the argument UID_SV or the value specified for the argument PASSWORD_SV violated restrictions defined by the data source. |
IM001 |
Driver does not support this function |
The driver specified by the data source name does not support the function. |
IM002 |
Data source not found and no default driver specified |
The data source name specified in the argument DSN_SV was not found in the ODBC initialization file nor was there a default driver specification. The ODBC initialization file could not be found. |
IM003 |
Driver specified by data source could not be loaded |
The driver specified in the data source specification associated with the data source name in the ODBC initialization file was not found or could not be loaded for some other reason. |
IM004 |
Driver’s EDSAllocEnv failed |
During EDSConnect, the Driver Manager called the driver’s EDSAllocEnv function and the driver returned an error. |
IM005 |
Driver’s EDSAllocConnect failed |
During EDSConnect, the Driver Manager called the driver’s EDSAllocConnect function and the driver returned an error. |
IM006 |
Driver’s EDSSetConnect-Option failed |
During EDSConnect, the Driver Manager called the driver’s EDSSetConnectOption function and the driver returned an error. (Function returns EDS_SUCCESS_WITH_INFO). |
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 Manager or driver was unable to allocate the memory required to support execution or completion of the function. |
S1T00 |
Timeout expired |
The timeout period expired before the connection to the data source completed. The timeout period is set through EDSSetConnectOption, EDS_LOGIN_TIMEOUT. |
See Also
EDSAllocConnect allocates a connection handle.
EDSAllocEnv allocates an environment handle.
EDSAllocStmt allocates a statement handle.
EDSConnect activates a connection.
EDSDisconnect disconnects from a data source.
EDSDeInitConnect disconnects from a data source and frees statement and connection handles.
EDSDeInitEnv disconnects from a data source and frees statement, connection, and environment handles.
EDSDriverConnect connects to a data source.
EDSFreeConnect frees a connection handle.
EDSFreeEnv frees an environment handle.
EDSFreeStmt frees the statement handle.