Documentation Home
Connectors and APIs Manual
Download this Manual
PDF (US Ltr) - 4.5Mb
PDF (A4) - 4.5Mb


Connectors and APIs Manual  /  ...  /  Basic Connector/ODBC Application Steps

5.6.1 Basic Connector/ODBC Application Steps

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.

  • Initialization statements.

    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:

Figure 5.12 Connector/ODBC Programming Flowchart

Content is described in the surrounding text.