MySQL 8.0 Reference Manual Including MySQL NDB Cluster 8.0

Chapter 31 Connectors and APIs

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 6.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 31.1, “MySQL APIs and Interfaces” lists many of the libraries and interfaces available for MySQL.

Table 31.1 MySQL APIs and Interfaces

Environment API Type Notes
Ada GNU Ada MySQL Bindings libmysqlclient See MySQL Bindings for GNU Ada
C C API libmysqlclient See MySQL 8.0 C API Developer Guide.
C++ Connector/C++ libmysqlclient See MySQL Connector/C++ 8.4 Developer Guide.
MySQL++ libmysqlclient See MySQL++ website.
MySQL wrapped libmysqlclient See MySQL wrapped.
Cocoa MySQL-Cocoa libmysqlclient Compatible with the Objective-C Cocoa environment. See http://mysql-cocoa.sourceforge.net/
D MySQL for D libmysqlclient See MySQL for D.
Eiffel Eiffel MySQL libmysqlclient See Section 31.13, “MySQL Eiffel Wrapper”.
Erlang erlang-mysql-driver libmysqlclient See erlang-mysql-driver.
Haskell Haskell MySQL Bindings Native Driver See Brian O'Sullivan's pure Haskell MySQL bindings.
hsql-mysql libmysqlclient See MySQL driver for Haskell.
Java/JDBC Connector/J Native Driver See MySQL Connector/J 8.0 Developer Guide.
Kaya MyDB libmysqlclient See MyDB.
Lua LuaSQL libmysqlclient See LuaSQL.
.NET/Mono Connector/NET Native Driver See MySQL Connector/NET Developer Guide.
Objective Caml OBjective Caml MySQL Bindings libmysqlclient See MySQL Bindings for Objective Caml.
Octave Database bindings for GNU Octave libmysqlclient See Database bindings for GNU Octave.
ODBC Connector/ODBC libmysqlclient See MySQL Connector/ODBC Developer Guide.
Perl DBI/DBD::mysql libmysqlclient See Section 31.9, “MySQL Perl API”.
Net::MySQL Native Driver See Net::MySQL at CPAN
PHP mysql, ext/mysql interface (deprecated) libmysqlclient See MySQL and PHP.
mysqli, ext/mysqli interface libmysqlclient See MySQL and PHP.
PDO_MYSQL libmysqlclient See MySQL and PHP.
PDO mysqlnd Native Driver
Python Connector/Python Native Driver See MySQL Connector/Python Developer Guide.
Python Connector/Python C Extension libmysqlclient See MySQL Connector/Python Developer Guide.
MySQLdb libmysqlclient See Section 31.10, “MySQL Python API”.
Ruby mysql2 libmysqlclient Uses libmysqlclient. See Section 31.11, “MySQL Ruby APIs”.
Scheme Myscsh libmysqlclient See Myscsh.
SPL sql_mysql libmysqlclient See sql_mysql for SPL.
Tcl MySQLtcl libmysqlclient See Section 31.12, “MySQL Tcl API”.