Access a database server with an ODBC application

An ODBC application needs to follow a basic set of steps in order to access a database server.

  1. Connect to the data source.
  2. Place the SQL statement string to be executed in a buffer. This is a text string.
  3. Submit the statement in order that it can be prepared or immediately run.
    • Retrieve and process the results.
    • If there are errors, retrieve the error information from the driver.
  4. End each transaction with a commit or rollback operation (if necessary).
  5. Terminate the connection.