Spec-Zone .ru
спецификации, руководства, описания, API

Chapter 21. Connectors and APIs

Table of Contents

21.1. MySQL Connector/ODBC
21.1.1. Connector/ODBC Versions
21.1.2. Connector/ODBC Introduction
21.1.3. Connector/ODBC Installation
21.1.4. Configuring Connector/ODBC
21.1.5. Connector/ODBC Examples
21.1.6. Connector/ODBC Reference
21.1.7. Connector/ODBC Notes and Tips
21.1.8. Connector/ODBC Support
21.2. MySQL Connector/Net
21.2.1. Connector/Net Versions
21.2.2. Connector/Net Installation
21.2.3. Connector/Net Visual Studio Integration
21.2.4. Connector/Net Tutorials
21.2.5. Connector/Net Programming
21.2.6. Connector/Net Connection String Options Reference
21.2.7. Connector/Net Support for Windows Store
21.2.8. EF 5 Support
21.2.9. Connector/Net API Reference
21.2.10. Connector/Net Support
21.2.11. Connector/Net FAQ
21.3. MySQL Connector/J
21.3.1. Overview of MySQL Connector/J
21.3.2. Connector/J Versions
21.3.3. Connector/J Installation
21.3.4. Connector/J Examples
21.3.5. Connector/J (JDBC) Reference
21.3.6. JDBC Concepts
21.3.7. Connection Pooling with Connector/J
21.3.8. Load Balancing with Connector/J
21.3.9. Failover with Connector/J
21.3.10. Using the Connector/J Interceptor Classes
21.3.11. Using Connector/J with Tomcat
21.3.12. Using Connector/J with JBoss
21.3.13. Using Connector/J with Spring
21.3.14. Using Connector/J with GlassFish
21.3.15. Troubleshooting Connector/J Applications
21.3.16. Connector/J Support
21.4. MySQL Connector/C++
21.4.1. How to Get MySQL Connector/C++
21.4.2. Installing MySQL Connector/C++ from a Binary Distribution
21.4.3. Installing MySQL Connector/C++ from Source
21.4.4. Building MySQL Connector/C++ Windows Applications with Microsoft Visual Studio
21.4.5. Building MySQL Connector/C++ Linux Applications with NetBeans
21.4.6. MySQL Connector/C++ Getting Started: Usage Examples
21.4.7. MySQL Connector/C++ Tutorials
21.4.8. MySQL Connector/C++ Debug Tracing
21.4.9. MySQL Connector/C++ Usage Notes
21.4.10. MySQL Connector/C++ Known Bugs and Issues
21.4.11. MySQL Connector/C++ Support
21.5. MySQL Connector/C
21.5.1. MySQL Connector/C Versions
21.5.2. MySQL Connector/C Supported Platforms
21.5.3. MySQL Connector/C Distribution Contents
21.5.4. Installing MySQL Connector/C
21.5.5. Building MySQL Connector/C Applications
21.6. MySQL Connector/Python
21.6.1. Guidelines for Python Developers
21.6.2. Connector/Python Versions
21.6.3. Connector/Python Installation
21.6.4. Connector/Python Coding Examples
21.6.5. Connector/Python Tutorials
21.6.6. Connector/Python Connection Arguments
21.6.7. Connector/Python API Reference
21.7. libmysqld, the Embedded MySQL Server Library
21.7.1. Compiling Programs with libmysqld
21.7.2. Restrictions When Using the Embedded MySQL Server
21.7.3. Options with the Embedded Server
21.7.4. Embedded Server Examples
21.8. MySQL C API
21.8.1. MySQL C API Implementations
21.8.2. Simultaneous MySQL Server and MySQL Connector/C Installations
21.8.3. Example C API Client Programs
21.8.4. Building and Running C API Client Programs
21.8.5. C API Data Structures
21.8.6. C API Function Overview
21.8.7. C API Function Descriptions
21.8.8. C API Prepared Statements
21.8.9. C API Prepared Statement Data Structures
21.8.10. C API Prepared Statement Function Overview
21.8.11. C API Prepared Statement Function Descriptions
21.8.12. C API Threaded Function Descriptions
21.8.13. C API Embedded Server Function Descriptions
21.8.14. C API Client Plugin Functions
21.8.15. Common Questions and Problems When Using the C API
21.8.16. Controlling Automatic Reconnection Behavior
21.8.17. C API Support for Multiple Statement Execution
21.8.18. C API Prepared Statement Problems
21.8.19. C API Prepared Statement Handling of Date and Time Values
21.8.20. C API Support for Prepared CALL Statements
21.9. MySQL PHP API
21.9.1. Overview of the MySQL PHP drivers
21.9.2. Original MySQL API (Mysql)
21.9.3. MySQL Improved Extension (Mysqli)
21.9.4. MySQL Functions (PDO_MYSQL) (MySQL (PDO))
21.9.5. MySQL Native Driver (Mysqlnd)
21.9.6. Mysqlnd replication and load balancing plugin (mysqlnd_ms)
21.9.7. Mysqlnd query result cache plugin (mysqlnd_qc)
21.9.8. Mysqlnd user handler plugin (mysqlnd_uh)
21.9.9. Mysqlnd connection multiplexing plugin (mysqlnd_mux)
21.9.10. Mysqlnd Memcache plugin (mysqlnd_memcache)
21.9.11. Connector/PHP
21.9.12. Common Problems with MySQL and PHP
21.9.13. Enabling Both mysql and mysqli inPHP
21.10. MySQL Perl API
21.11. MySQL Python API
21.12. MySQL Ruby APIs
21.12.1. The MySQL/Ruby API
21.12.2. The Ruby/MySQL API
21.13. MySQL Tcl API
21.14. MySQL Eiffel Wrapper

MySQL Connectors provide connectivity to the MySQL server for client programs. APIs provide low-level access to the MySQL protocol and MySQL resources. Both Connectors and the APIs enable you to connect and execute MySQL statements from another language or environment, including ODBC, Java (JDBC), Perl, Python, PHP, Ruby, and native C and embedded MySQL instances.

Note

Connector version numbers do not correlate with MySQL Server version numbers. See Table 21.2, "MySQL Connector Versions and MySQL Server Versions".

MySQL Connectors

Oracle develops a number of connectors:

The MySQL C API

For direct access to using MySQL natively within a C application, there are two methods:

See also Section 21.8.1, "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, "MySQL 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 21.1, "MySQL APIs and Interfaces" lists many of the libraries and interfaces available for MySQL. Table 21.2, "MySQL Connector Versions and MySQL Server Versions" shows which MySQL Server versions each connector supports.

Table 21.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 Section 21.8, "MySQL C API".
C Connector/C Replacement for libmysqlclient See Section 21.5, "MySQL Connector/C".
C++ Connector/C++ libmysqlclient See Section 21.4, "MySQL Connector/C++".
MySQL++ libmysqlclient See MySQL++ Web site.
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 21.14, "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 Section 21.3, "MySQL Connector/J".
Kaya MyDB libmysqlclient See MyDB.
Lua LuaSQL libmysqlclient See LuaSQL.
.NET/Mono Connector/Net Native Driver See Section 21.2, "MySQL Connector/Net".
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 Section 21.1, "MySQL Connector/ODBC".
Perl DBI/DBD::mysql libmysqlclient See Section 21.10, "MySQL Perl API".
Net::MySQL Native Driver See Net::MySQL at CPAN
PHP mysql, ext/mysql interface (deprecated) libmysqlclient See Section 21.9.2, "Original MySQL API (Mysql)".
mysqli, ext/mysqli interface libmysqlclient See Section 21.9.3, "MySQL Improved Extension (Mysqli)".
PDO_MYSQL libmysqlclient See Section 21.9.4, "MySQL Functions (PDO_MYSQL) (MySQL (PDO))".
PDO mysqlnd Native Driver
Python Connector/Python Native Driver See Section 21.6, "MySQL Connector/Python".
MySQLdb libmysqlclient See Section 21.11, "MySQL Python API".
Ruby MySQL/Ruby libmysqlclient Uses libmysqlclient. See Section 21.12.1, "The MySQL/Ruby API".
Ruby/MySQL Native Driver See Section 21.12.2, "The Ruby/MySQL API".
Scheme Myscsh libmysqlclient See Myscsh.
SPL sql_mysql libmysqlclient See sql_mysqlfor SPL.
Tcl MySQLtcl libmysqlclient See Section 21.13, "MySQL Tcl API".

Table 21.2. MySQL Connector Versions and MySQL Server Versions

Connector Connector version MySQL Server version
Connector/C 6.1.0 GA 5.6, 5.5, 5.1, 5.0, 4.1
Connector/C++ 1.0.5 GA 5.6, 5.5, 5.1
Connector/J 5.1.8 5.6, 5.5, 5.1, 5.0, 4.1
Connector/Net 6.5 5.6, 5.5, 5.1, 5.0
Connector/Net 6.4 5.6, 5.5, 5.1, 5.0
Connector/Net 6.3 5.6, 5.5, 5.1, 5.0
Connector/Net 6.2 (No longer supported) 5.6, 5.5, 5.1, 5.0
Connector/Net 6.1 (No longer supported) 5.6, 5.5, 5.1, 5.0
Connector/Net 6.0 (No longer supported) 5.6, 5.5, 5.1, 5.0
Connector/Net 5.2 (No longer supported) 5.6, 5.5, 5.1, 5.0
Connector/Net 1.0 (No longer supported) 5.0, 4.0
Connector/ODBC 5.1 5.6, 5.5, 5.1, 5.0, 4.1.1+
Connector/ODBC 3.51 (Unicode not supported) 5.6, 5.5, 5.1, 5.0, 4.1