Interacting with a MySQL server from an applications using the Connector/ODBC typically involves the following operations:
Configure the Connector/ODBC DSN.
Connect to MySQL server.
This might include: allocate environment handle, set ODBC version, allocate connection handle, connect to MySQL Server, and set optional connection attributes.
This might include: allocate statement handle and set optional statement attributes.
Execute SQL statements.
This might include: prepare the SQL statement and execute the SQL statement, or execute it directly without prepare.
Retrieve results, depending on the statement type.
For SELECT / SHOW / Catalog API the results might include: get number of columns, get column information, fetch rows, and get the data to buffers. For Delete / Update / Insert the results might include the number of rows affected.
Perform transactions; perform commit or rollback.
Disconnect from the server.
This might include: disconnect the connection and free the connection and environment handles.
Most applications use some variation of these steps. The basic application steps are also shown in the following diagram: