Updated on 2023-10-23 GMT+08:00

Development Process

Figure 1 ODBC-based application development process

APIs Involved in the Development Process

Table 1 API description

Function

API

Allocate a handle

SQLAllocHandle is a generic function for allocating a handle. It can replace the following functions:

Set environment attributes

SQLSetEnvAttr

Set connection attributes

SQLSetConnectAttr

Set statement attributes

SQLSetStmtAttr

Connect to a data source

SQLConnect

Bind a buffer to a column in the result set

SQLBindCol

Bind the parameter marker of an SQL statement to a buffer

SQLBindParameter

Return the error message of the last operation

SQLGetDiagRec

Prepare an SQL statement for execution

SQLPrepare

Run a prepared SQL statement

SQLExecute

Run an SQL statement directly

SQLExecDirect

Fetch the next row (or rows) from the result set

SQLFetch

Return data in a column of the result set

SQLGetData

Get the column information from a result set

SQLColAttribute

Disconnect from a data source

SQLDisconnect

Release a handle

SQLFreeHandle is a generic function for releasing a handle. It can replace the following functions:

If an execution request (not in a transaction block) received in the database contains multiple statements, the request is packed into a transaction. If one of the statements fails, the entire request will be rolled back.

ODBC connects applications to the database and delivers the SQL commands sent by an application to the database. It does not parse the SQL syntax. Therefore, when confidential information (such as a plaintext password) is written into the SQL statement delivered by an application, the confidential information is exposed in the driver log.