The HCL OneDB ODBC Driver API

An application uses the HCL OneDB™ ODBC Driver API to make a connection to a data source, send SQL statements to a data source, process result data dynamically, and terminate a connection.

The driver enables your application to perform the following steps:
  1. Connect to the data source.

    You can connect to the data source through a DSN connection, or you can use DSN-less connection strings. Specify the data-source name and any additional information needed to complete the connection.

  2. Process one or more SQL statements:
    1. Place the SQL text string in a buffer. If the statement includes parameter markers, set the parameter values.
    2. If the statement returns a result set, either assign a cursor name for the statement or let the driver assign one.
    3. Either prepare the statement or submit it for immediate execution.
    4. If the statement creates a result set, you can inquire about the attributes of the result set, such as the number of columns and the name and type of a specific column. For each column in the result set, assign storage and fetch the results.
    5. If the statement causes an error, retrieve error information from the driver and take the appropriate action.
  3. End any transaction by committing it or rolling it back.
  4. Terminate the connection when the application finishes interacting with the data source.

Every HCL OneDB ODBC Driver function name starts with the prefix SQL. Each function accepts one or more arguments. Arguments are defined as input (to the driver) or output (from the driver).

The following figure shows the basic function calls that an application makes even though an application generally calls other functions also.
Figure 1: Sample listing of function calls that the HCL OneDB ODBC Driver application makes

This graphic illustrates the basic function calls that an application makes. The illustration is composed of a series of vertical boxes connects by down-facing arrows. The first box contains these functions, in order: SQLFreeHandle(SQL_HANDLE_ENV), SQLAllocHandle(Sql_HANDLE_DBC), SQLConnect, and SQLAllocHandle(SQL_HANDLE_STMT). This box is connected to the function ProcessSQL Statements which leads into the Receive Results function which is connected to another box that contains these functions, in order: SQLFreeStmt, SQLDisconnect, SQLFreeHandle(SQL_HANDLE_DBC), and SQLFreeHandle(SQL_HANDLE_ENV). Four arrows connect this second box to the box and functions above it. The first arrow places the CLOSE option function underneath SQLFreeStmt and connects to the Process SQL statements function. The second arrow places the SQLFreeHandle(SQL_HANDLE_STMT) function above the SQLDisconnect function and connects to the SQLAllocHandle(SQL_HANDLE_STMT) function in the first box. The third arrow attaches in between the SQLDisconnect function and the SQLFreeHandle(SQL_HANDLE_DBC) functions in the second box and connects to the SQLConnect Function in the first box. The final arrow attaches in between the SQLFreeHandle(SQL_HANDLE_DBC) and the SQLFreeHandle(SQL_HANDLE_ENV) functions in the second box and connect to the SQLAllocHandle(SQL_HANDLE_DBC) function in the first box.