Connecting to MySQL

Introduction

This section describes the connection between ExcelVGA and MySQL.

How do I connect?

To connect to a MySQL database from ExcelVBA, we use a mechanism called ODBC.

ODBC drivers provide application programs with standard, uniform SQL access to DBMS databases. ODBC drivers allow application program designers and users to ignore SQL differences between various DBMS systems. (参考)

The ODBC driver stands between ExcelVBA and the DB and exchanges data. In order for it to work, the following conditions must be met:

  • If Excel is a 32-bit version, the ODBC driver should also be a 32-bit version.
  • If Excel is a 64-bit version, the ODBC driver should also be a 64-bit version.

The next chapter, ODBC Connection, uses the 32-bit version of Excel as an example and explains how to install the 32-bit version of the ODBC driver.