Each OpenESQL preprocessor option - ODBC and ADO -
The OpenESQL preprocessor
requires that you create a connection to the database using either an explicit or an implicit connection.
Important: You must have the appropriate drivers and/or data providers installed and data source names created before you can establish a connection.
Each OpenESQL preprocessor type requires a different configuration.
Explicit Connections (recommended)
An explicit connection is one established within your program code using the CONNECT embedded SQL statement, and disconnected using the DISCONNECT embedded SQL statement. This enables you to make connections to multiple databases at runtime on an as needed basis.
Use explicit connections when your program accesses multiple data sources or databases.
See the
CONNECT and
DISCONNECT embedded SQL topics for details.
Note: For ODBC connections only, you can specify an explicit disconnect and rollback to execute automatically if the program terminates abnormally. See the
INIT compiler directive option topic for more information.
Implicit Connections
An implicit connection is one defined by way of SQL compiler directive options at compile time. This method establishes a single connection to one database. Use this method only when your program accesses only one database.
Use a combination of the INIT, DB, and possibly PASS compiler directive options to create the connection.
- INIT - to identify the data source name
- DB - to identify the database
- PASS - to provide a user ID and password if required
OpenESQL automatically disconnects from the data source when the program terminates.
Important: ADO.NET does not support the use of implicit connections.