Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 43.3Mb
PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.3Kb
Man Pages (Zip) - 402.5Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
Excerpts from this Manual

MySQL 8.0 Reference Manual  /  Connectors and APIs

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:

  • Connector/C++ enables C++ applications to connect to MySQL.

  • Connector/J provides driver support for connecting to MySQL from Java applications using the standard Java Database Connectivity (JDBC) API.

  • Connector/NET enables developers to create .NET applications that connect to MySQL. Connector/NET implements a fully functional ADO.NET interface and provides support for use with ADO.NET aware tools. Applications that use Connector/NET can be written in any supported .NET language.

  • Connector/ODBC provides driver support for connecting to MySQL using the Open Database Connectivity (ODBC) API. Support is available for ODBC connectivity from Windows, Unix, and macOS platforms.

  • Connector/Python provides driver support for connecting to MySQL from Python applications using an API that is compliant with thePython DB API version 2.0. No additional Python modules or MySQL client libraries are required.

  • Connector/Node.js provides an asynchronous API for connecting to MySQL from Node.js applications using X Protocol. Connector/Node.js supports managing database sessions and schemas, working with MySQL Document Store collections and using raw SQL statements.

The MySQL C API

For direct access to using MySQL natively within a C application, theC API provides low-level access to the MySQL client/server protocol through thelibmysqlclient 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 alsoMySQL 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, theC API is where to start. A number of programmer's utilities are available to help with the process; seeSection 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, usinglibmysqlclient or by implementing anative driver. The two solutions offer different benefits:

  • Usinglibmysqlclient offers complete compatibility with MySQL because it uses the same libraries as the MySQL client applications. However, the feature set is limited to the implementation and interfaces exposed throughlibmysqlclient and the performance may be lower as data is copied between the native language, and the MySQL API components.

  • Native drivers are an implementation of the MySQL network protocol entirely within the host language or environment. Native drivers are fast, as there is less copying of data between components, and they can offer advanced functionality not available through the standard MySQL API. Native drivers are also easier for end users to build and deploy because no copy of the MySQL client libraries is needed to build the native driver components.

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

Table 31.1 MySQL APIs and Interfaces

EnvironmentAPITypeNotes
AdaGNU Ada MySQL BindingslibmysqlclientSeeMySQL Bindings for GNU Ada
CC APIlibmysqlclientSeeMySQL 8.0 C API Developer Guide.
C++Connector/C++libmysqlclientSeeMySQL Connector/C++ 9.5 Developer Guide.
MySQL++libmysqlclientSeeMySQL++ website.
MySQL wrappedlibmysqlclientSeeMySQL wrapped.
CocoaMySQL-CocoalibmysqlclientCompatible with the Objective-C Cocoa environment. Seehttp://mysql-cocoa.sourceforge.net/
DMySQL for DlibmysqlclientSeeMySQL for D.
EiffelEiffel MySQLlibmysqlclientSeeSection 31.13, “MySQL Eiffel Wrapper”.
Erlangerlang-mysql-driverlibmysqlclientSeeerlang-mysql-driver.
HaskellHaskell MySQL BindingsNative DriverSeeBrian O'Sullivan's pure Haskell MySQL bindings.
hsql-mysqllibmysqlclientSeeMySQL driver for Haskell.
Java/JDBCConnector/JNative DriverSeeMySQL Connector/J Developer Guide.
KayaMyDBlibmysqlclientSeeMyDB.
LuaLuaSQLlibmysqlclientSeeLuaSQL.
.NET/MonoConnector/NETNative DriverSeeMySQL Connector/NET Developer Guide.
Objective CamlOBjective Caml MySQL BindingslibmysqlclientSeeMySQL Bindings for Objective Caml.
OctaveDatabase bindings for GNU OctavelibmysqlclientSeeDatabase bindings for GNU Octave.
ODBCConnector/ODBClibmysqlclientSeeMySQL Connector/ODBC Developer Guide.
PerlDBI/DBD::mysqllibmysqlclientSeeSection 31.9, “MySQL Perl API”.
Net::MySQLNative DriverSeeNet::MySQL at CPAN
PHPmysql,ext/mysql interface (deprecated)libmysqlclientSeeMySQL and PHP.
mysqli,ext/mysqli interfacelibmysqlclientSeeMySQL and PHP.
PDO_MYSQLlibmysqlclientSeeMySQL and PHP.
PDO mysqlndNative Driver
PythonConnector/PythonNative DriverSeeMySQL Connector/Python Developer Guide.
PythonConnector/Python C ExtensionlibmysqlclientSeeMySQL Connector/Python Developer Guide.
MySQLdblibmysqlclientSeeSection 31.10, “MySQL Python API”.
Rubymysql2libmysqlclientUseslibmysqlclient. SeeSection 31.11, “MySQL Ruby APIs”.
SchemeMyscshlibmysqlclientSeeMyscsh.
SPLsql_mysqllibmysqlclientSeesql_mysql for SPL.
TclMySQLtcllibmysqlclientSeeSection 31.12, “MySQL Tcl API”.