ODBC Connection User Guide > Reference > ODBC_DRIVER_CONNECT Function
  

ODBC_DRIVER_CONNECT Function
Connect to an ODBC compliant data source.
Usage
connect_handle = ODBC_DRIVER_CONNECT(env_handle, driver_info)
Input Parameters
env_handle—An ODBC environment handle, as returned by ODBC_INIT.
Driver_info—String identifying driver specific information.
Returned Value
connect_handle—An ODBC connection handle, used to identify this data source connection in other function calls. If the function fails, -1 is returned.
Keywords
Auto_commit—An integer value that specifies whether to use autocommit or manual-mode.
*Manual commit mode (Auto_commit = 0) - In this mode users must explicitly use the ODBC_COMMIT function to commit any changes.
*Autocommit mode (Auto_commit = 1) - In this mode users do not have to use the ODBC_COMMIT function. All changes are committed right after the SQL statement is executed.
Output—If successful, this variable contains the completed connection string.
Discussion
This function is an alternative to the ODBC_CONNECT function. It supports data sources that require more connection information.
Driver_Info is a connection string that must contain all of the required information to connect to a data source. The default system information such as system DSN will not be used by this function. Please check your driver specific documents for all the available values that can be used within a connection string.
Example
This is an example for an SQL Server.
oid = odbc_init()
driver_info = "DSN=MyDSN;SERVER=MyServer;UID="";PWD="";DATABASE=pubs;"
oid2=odbc_driver_connect(oid,driver_info,output=output)

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.