Opens a connection to a database system and returns a handle to that system. This allows you to submit SQL statements to the database for execution.
hdbc = DB_Connect (con_string)
The handle to a database as returned by DB_Connect. HDATABASE.
A connection STRING identifying the database system and any additional logon information required by your driver. The connection string has the form:
"DSN=data source name [;attr=value[; attr=value]...]"where data source name is the name that you specified when you generated the OBDC.INI file during the installation of your ODBC driver and attr is a keyword such as UID (User ID) or PWD (Password). For additional information about the string format that is required for your driver, refer to the documentation of the driver.
To connect to Oracle databases, use the Oracle version of the Oracle ODBC driver. For instance, you can use the Oracle ODBC driver provided by the Oracle instant client. If you try to use the Microsoft ODBC driver that is installed by default, DB_Connect will succeed but further DML statements may fail.
You can issue successive calls to DB_Connect to open simultaneous connections to different database systems, or simultaneous connections to the same database system, if such connections are supported by the database system. Use DB_Disconnect to close the connection and to release the resources. The connection handle and all resources still open for SQL statements when you use DB_Disconnect.
DB_Connect calls do not work from a remote agent. To connect to a database system from a remote agent, use the local DSN and point that to the remote agent. Configure the DSN to point to the machine where the database is installed. For example, if you are using a DSN for Excel, map the network drive to the location where the Excel sheet is stored and select the file as worksheet in the DSN settings.
hdbc = DB_Connect ("DSN=QESS;SRVR=PIONI;UID=sa;PWD=tester")To connect to a database system from a remote agent using the local DSN for Excel server, which is LOCALMACHINE: