Chapter 29 Connectors and APIs

Table of Contents

29.1 MySQL Connector/C++
29.2 MySQL Connector/J
29.3 MySQL Connector/NET
29.4 MySQL Connector/ODBC
29.5 MySQL Connector/Python
29.6 MySQL Connector/Node.js
29.7 MySQL C API
29.8 MySQL PHP API
29.9 MySQL Perl API
29.10 MySQL Python API
29.11 MySQL Ruby APIs
29.11.1 The MySQL/Ruby API
29.11.2 The Ruby/MySQL API
29.12 MySQL Tcl API
29.13 MySQL Eiffel Wrapper

MySQL Connectors provide connectivity to the MySQL server for client programs. APIs provide low-level access to MySQL resources using either the classic MySQL protocol or X Protocol. Both Connectors and the APIs enable you to connect and execute MySQL statements from another language or environment, including ODBC, Java (JDBC), C++, Python, Node.js, PHP, Perl, Ruby, and C.

MySQL Connectors

Oracle develops a number of connectors:

The MySQL C API

For direct access to using MySQL natively within a C application, the C API provides low-level access to the MySQL client/server protocol through the libmysqlclient client library. This is the primary method used to connect to an instance of the MySQL server, and is used both by MySQL command-line clients and many of the MySQL Connectors and third-party APIs detailed here.

libmysqlclient is included in MySQL distributions distributions.

See also MySQL C API Implementations.

To access MySQL from a C application, or to build an interface to MySQL for a language not supported by the Connectors or APIs in this chapter, the C API is where to start. A number of programmer's utilities are available to help with the process; see Section 4.7, “Program Development Utilities”.

Third-Party MySQL APIs

The remaining APIs described in this chapter provide an interface to MySQL from specific application languages. These third-party solutions are not developed or supported by Oracle. Basic information on their usage and abilities is provided here for reference purposes only.

All the third-party language APIs are developed using one of two methods, using libmysqlclient or by implementing a native driver. The two solutions offer different benefits:

Table 29.1, “MySQL APIs and Interfaces” lists many of the libraries and interfaces available for MySQL.

Table 29.1 MySQL APIs and Interfaces

EnvironmentAPITypeNotes
AdaGNU Ada MySQL BindingslibmysqlclientSee MySQL Bindings for GNU Ada
CC APIlibmysqlclientSee MySQL 8.0 C API Developer Guide.
C++Connector/C++libmysqlclientSee MySQL Connector/C++ 8.0 Developer Guide.
MySQL++libmysqlclientSee MySQL++ website.
MySQL wrappedlibmysqlclientSee MySQL wrapped.
CocoaMySQL-CocoalibmysqlclientCompatible with the Objective-C Cocoa environment. See http://mysql-cocoa.sourceforge.net/
DMySQL for DlibmysqlclientSee MySQL for D.
EiffelEiffel MySQLlibmysqlclientSee Section 29.13, “MySQL Eiffel Wrapper”.
Erlangerlang-mysql-driverlibmysqlclientSee erlang-mysql-driver.
HaskellHaskell MySQL BindingsNative DriverSee Brian O'Sullivan's pure Haskell MySQL bindings.
hsql-mysqllibmysqlclientSee MySQL driver for Haskell.
Java/JDBCConnector/JNative DriverSee MySQL Connector/J 5.1 Developer Guide.
KayaMyDBlibmysqlclientSee MyDB.
LuaLuaSQLlibmysqlclientSee LuaSQL.
.NET/MonoConnector/NETNative DriverSee MySQL Connector/NET Developer Guide.
Objective CamlOBjective Caml MySQL BindingslibmysqlclientSee MySQL Bindings for Objective Caml.
OctaveDatabase bindings for GNU OctavelibmysqlclientSee Database bindings for GNU Octave.
ODBCConnector/ODBClibmysqlclientSee MySQL Connector/ODBC Developer Guide.
PerlDBI/DBD::mysqllibmysqlclientSee Section 29.9, “MySQL Perl API”.
Net::MySQLNative DriverSee Net::MySQL at CPAN
PHPmysql, ext/mysql interface (deprecated)libmysqlclientSee Original MySQL API.
mysqli, ext/mysqli interfacelibmysqlclientSee MySQL Improved Extension.
PDO_MYSQLlibmysqlclientSee MySQL Functions (PDO_MYSQL).
PDO mysqlndNative Driver
PythonConnector/PythonNative DriverSee MySQL Connector/Python Developer Guide.
PythonConnector/Python C ExtensionlibmysqlclientSee MySQL Connector/Python Developer Guide.
MySQLdblibmysqlclientSee Section 29.10, “MySQL Python API”.
RubyMySQL/RubylibmysqlclientUses libmysqlclient. See Section 29.11.1, “The MySQL/Ruby API”.
Ruby/MySQLNative DriverSee Section 29.11.2, “The Ruby/MySQL API”.
SchemeMyscshlibmysqlclientSee Myscsh.
SPLsql_mysqllibmysqlclientSee sql_mysql for SPL.
TclMySQLtcllibmysqlclientSee Section 29.12, “MySQL Tcl API”.

29.1 MySQL Connector/C++
29.2 MySQL Connector/J
29.3 MySQL Connector/NET
29.4 MySQL Connector/ODBC
29.5 MySQL Connector/Python
29.6 MySQL Connector/Node.js
29.7 MySQL C API
29.8 MySQL PHP API
29.9 MySQL Perl API
29.10 MySQL Python API
29.11 MySQL Ruby APIs
29.12 MySQL Tcl API
29.13 MySQL Eiffel Wrapper