Connectors and APIs Manual

Abstract

This manual describes the Connectors and APIs that can be used with MySQL.

For legal information, see the Legal Notices.

For help with using MySQL, please visit the MySQL Forums, where you can discuss your issues with other MySQL users.

Document generated on: 2020-11-26 (revision: 68141)


Table of Contents

Preface and Legal Notices
1 Introduction
2 MySQL Connector/C++ Developer Guide
2.1 Introduction to Connector/C++
2.2 Obtaining Connector/C++
2.3 Installing Connector/C++ from a Binary Distribution
2.4 Installing Connector/C++ from Source
2.4.1 Source Installation System Prerequisites
2.4.2 Obtaining and Unpacking a Connector/C++ Source Distribution
2.4.3 Installing Connector/C++ from Source
2.4.4 Connector/C++ Source-Configuration Options
2.5 Building Connector/C++ Applications
2.5.1 Building Connector/C++ Applications: General Considerations
2.5.2 Building Connector/C++ Applications: Platform-Specific Considerations
2.6 Connector/C++ Known Issues
2.7 Connector/C++ Support
3 MySQL Connector/J Developer Guide
3.1 Overview of MySQL Connector/J
3.2 Connector/J Versions, and the MySQL and Java Versions They Require
3.3 Connector/J Installation
3.3.1 Installing Connector/J from a Binary Distribution
3.3.2 Installing Connector/J Using Maven
3.3.3 Installing from Source
3.3.4 Upgrading from an Older Version
3.3.5 Testing Connector/J
3.4 Connector/J Examples
3.5 Connector/J Reference
3.5.1 Driver/Datasource Class Name
3.5.2 Connection URL Syntax
3.5.3 Configuration Properties
3.5.4 JDBC API Implementation Notes
3.5.5 Java, JDBC, and MySQL Types
3.5.6 Using Character Sets and Unicode
3.5.7 Connecting Securely Using SSL
3.5.8 Connecting Using Unix Domain Sockets
3.5.9 Connecting Using Named Pipes
3.5.10 Connecting Using PAM Authentication
3.5.11 Using Source/Replica Replication with ReplicationConnection
3.5.12 Support for DNS SRV Records
3.5.13 Mapping MySQL Error Numbers to JDBC SQLState Codes
3.6 JDBC Concepts
3.6.1 Connecting to MySQL Using the JDBC DriverManager Interface
3.6.2 Using JDBC Statement Objects to Execute SQL
3.6.3 Using JDBC CallableStatements to Execute Stored Procedures
3.6.4 Retrieving AUTO_INCREMENT Column Values through JDBC
3.7 Connection Pooling with Connector/J
3.8 Multi-Host Connections
3.8.1 Configuring Server Failover for Connections Using JDBC
3.8.2 Configuring Server Failover for Connections Using X DevAPI
3.8.3 Configuring Load Balancing with Connector/J
3.8.4 Configuring Source/Replica Replication with Connector/J
3.8.5 Advanced Load-balancing and Failover Configuration
3.9 Using the X DevAPI with Connector/J: Special Topics
3.9.1 Connection Compression Using X DevAPI
3.9.2 Schema Validation
3.10 Using the Connector/J Interceptor Classes
3.11 Using Logging Frameworks with SLF4J
3.12 Using Connector/J with Tomcat
3.13 Using Connector/J with Spring
3.13.1 Using JdbcTemplate
3.13.2 Transactional JDBC Access
3.13.3 Connection Pooling with Spring
3.14 Troubleshooting Connector/J Applications
3.15 Known Issues and Limitations
3.16 Connector/J Support
3.16.1 Connector/J Community Support
3.16.2 How to Report Connector/J Bugs or Problems
4 MySQL Connector/NET Developer Guide
4.1 Introduction to MySQL Connector/NET
4.2 Connector/NET Versions
4.3 Connector/NET Installation
4.3.1 Installing Connector/NET on Windows
4.3.2 Installing Connector/NET on Unix with Mono
4.3.3 Installing Connector/NET from Source
4.4 Connector/NET Connections
4.4.1 Creating a Connector/NET Connection String
4.4.2 Connecting With TCP/IP Over SSH
4.4.3 Managing a Connection Pool in Connector/NET
4.4.4 Handling Connection Errors
4.4.5 Connector/NET 8.0 Connection Options Reference
4.4.6 Connector/NET 6.10 Connection-String Options Reference
4.5 Connector/NET Programming
4.5.1 Using GetSchema on a Connection
4.5.2 Using MySqlCommand
4.5.3 Overview of Connector/NET Authentication
4.5.4 Using Connector/NET with Table Caching
4.5.5 Using the Connector/NET with Prepared Statements
4.5.6 Accessing Stored Procedures with Connector/NET
4.5.7 Handling BLOB Data With Connector/NET
4.5.8 Asynchronous Methods
4.5.9 Using the Connector/NET Interceptor Classes
4.5.10 Handling Date and Time Information in Connector/NET
4.5.11 Using the MySqlBulkLoader Class
4.5.12 Using the Connector/NET Trace Source Object
4.5.13 Binary and Nonbinary Issues
4.5.14 Character Set Considerations for Connector/NET
4.5.15 Using Connector/NET with Crystal Reports
4.5.16 ASP.NET Provider Model
4.5.17 Working with Partial Trust / Medium Trust
4.6 Connector/NET Tutorials
4.6.1 Tutorial: An Introduction to Connector/NET Programming
4.6.2 Tutorial: Connector/NET ASP.NET Membership and Role Provider
4.6.3 Tutorial: Connector/NET ASP.NET Profile Provider
4.6.4 Tutorial: Web Parts Personalization Provider
4.6.5 Tutorial: Simple Membership Web Provider
4.6.6 Tutorial: Using an Entity Framework Entity as a Windows Forms Data Source
4.6.7 Tutorial: Data Binding in ASP.NET Using LINQ on Entities
4.6.8 Tutorial: Generating MySQL DDL from an Entity Framework Model
4.6.9 Tutorial: Basic CRUD Operations with Connector/NET
4.6.10 Tutorial: Configuring SSL with Connector/NET
4.6.11 Tutorial: Using MySqlScript
4.7 Connector/NET for Entity Framework
4.7.1 Entity Framework 6 Support
4.7.2 Entity Framework Core Support
4.8 Connector/NET API Reference
4.8.1 Microsoft.EntityFrameworkCore Namespace
4.8.2 MySql.Data.EntityFramework Namespace
4.8.3 MySql.Data.EntityFrameworkCore Namespace
4.8.4 MySql.Data.MySqlClient Namespace
4.8.5 MySql.Data.MySqlClient.Authentication Namespace
4.8.6 MySql.Data.MySqlClient.Interceptors Namespace
4.8.7 MySql.Data.MySqlClient.Memcached Namespace
4.8.8 MySql.Data.MySqlClient.Replication Namespace
4.8.9 MySql.Data.Types Namespace
4.8.10 MySql.Web Namespace
4.9 Connector/NET Support
4.9.1 Connector/NET Community Support
4.9.2 How to Report Connector/NET Problems or Bugs
5 MySQL Connector/ODBC Developer Guide
5.1 Introduction to MySQL Connector/ODBC
5.2 Connector/ODBC Versions
5.3 General Information About ODBC and Connector/ODBC
5.3.1 Connector/ODBC Architecture
5.3.2 ODBC Driver Managers
5.4 Connector/ODBC Installation
5.4.1 Installing Connector/ODBC on Windows
5.4.2 Installing Connector/ODBC on Unix-like Systems
5.4.3 Installing Connector/ODBC on macOS
5.4.4 Building Connector/ODBC from a Source Distribution on Windows
5.4.5 Building Connector/ODBC from a Source Distribution on Unix
5.4.6 Building Connector/ODBC from a Source Distribution on macOS
5.4.7 Installing Connector/ODBC from the Development Source Tree
5.5 Configuring Connector/ODBC
5.5.1 Overview of Connector/ODBC Data Source Names
5.5.2 Connector/ODBC Connection Parameters
5.5.3 Configuring a Connector/ODBC DSN on Windows
5.5.4 Configuring a Connector/ODBC DSN on macOS
5.5.5 Configuring a Connector/ODBC DSN on Unix
5.5.6 Connecting Without a Predefined DSN
5.5.7 ODBC Connection Pooling
5.5.8 Getting an ODBC Trace File
5.6 Connector/ODBC Examples
5.6.1 Basic Connector/ODBC Application Steps
5.6.2 Step-by-step Guide to Connecting to a MySQL Database through Connector/ODBC
5.6.3 Connector/ODBC and Third-Party ODBC Tools
5.6.4 Using Connector/ODBC with Microsoft Access
5.6.5 Using Connector/ODBC with Microsoft Word or Excel
5.6.6 Using Connector/ODBC with Crystal Reports
5.6.7 Connector/ODBC Programming
5.7 Connector/ODBC Reference
5.7.1 Connector/ODBC API Reference
5.7.2 Connector/ODBC Data Types
5.7.3 Connector/ODBC Error Codes
5.8 Connector/ODBC Notes and Tips
5.8.1 Connector/ODBC General Functionality
5.8.2 Connector/ODBC Application-Specific Tips
5.8.3 Connector/ODBC and the Application Both Use OpenSSL
5.8.4 Connector/ODBC Errors and Resolutions (FAQ)
5.9 Connector/ODBC Support
5.9.1 Connector/ODBC Community Support
5.9.2 How to Report Connector/ODBC Problems or Bugs
6 MySQL Connector/Python Developer Guide
6.1 Introduction to MySQL Connector/Python
6.2 Guidelines for Python Developers
6.3 Connector/Python Versions
6.4 Connector/Python Installation
6.4.1 Obtaining Connector/Python
6.4.2 Installing Connector/Python from a Binary Distribution
6.4.3 Installing Connector/Python from a Source Distribution
6.4.4 Verifying Your Connector/Python Installation
6.5 Connector/Python Coding Examples
6.5.1 Connecting to MySQL Using Connector/Python
6.5.2 Creating Tables Using Connector/Python
6.5.3 Inserting Data Using Connector/Python
6.5.4 Querying Data Using Connector/Python
6.6 Connector/Python Tutorials
6.6.1 Tutorial: Raise Employee's Salary Using a Buffered Cursor
6.7 Connector/Python Connection Establishment
6.7.1 Connector/Python Connection Arguments
6.7.2 Connector/Python Option-File Support
6.8 Connector/Python Other Topics
6.8.1 Connector/Python Connection Pooling
6.8.2 Connector/Python Django Back End
6.9 Connector/Python API Reference
6.9.1 mysql.connector Module
6.9.2 connection.MySQLConnection Class
6.9.3 pooling.MySQLConnectionPool Class
6.9.4 pooling.PooledMySQLConnection Class
6.9.5 cursor.MySQLCursor Class
6.9.6 Subclasses cursor.MySQLCursor
6.9.7 constants.ClientFlag Class
6.9.8 constants.FieldType Class
6.9.9 constants.SQLMode Class
6.9.10 constants.CharacterSet Class
6.9.11 constants.RefreshOption Class
6.9.12 Errors and Exceptions
7 MySQL and PHP
7.1 Introduction to the MySQL PHP API
7.2 Overview of the MySQL PHP drivers
7.2.1 Introduction
7.2.2 Terminology overview
7.2.3 Choosing an API
7.2.4 Choosing a library
7.2.5 Concepts
7.3 MySQL Improved Extension
7.3.1 Overview
7.3.2 Quick start guide
7.3.3 Installing/Configuring
7.3.4 The mysqli Extension and Persistent Connections
7.3.5 Predefined Constants
7.3.6 Notes
7.3.7 The MySQLi Extension Function Summary
7.3.8 Examples
7.3.9 The mysqli class
7.3.10 The mysqli_stmt class
7.3.11 The mysqli_result class
7.3.12 The mysqli_driver class
7.3.13 The mysqli_warning class
7.3.14 The mysqli_sql_exception class
7.3.15 Aliases and deprecated Mysqli Functions
7.3.16 Changelog
7.4 MySQL Functions (PDO_MYSQL)
7.4.1 PDO_MYSQL DSN
7.5 Original MySQL API
7.5.1 Installing/Configuring
7.5.2 Changelog
7.5.3 Predefined Constants
7.5.4 Examples
7.5.5 MySQL Functions
7.6 MySQL Native Driver
7.6.1 Overview
7.6.2 Installation
7.6.3 Runtime Configuration
7.6.4 Incompatibilities
7.6.5 Persistent Connections
7.6.6 Statistics
7.6.7 Notes
7.6.8 Memory management
7.6.9 MySQL Native Driver Plugin API
7.7 Mysqlnd replication and load balancing plugin
7.7.1 Key Features
7.7.2 Limitations
7.7.3 On the name
7.7.4 Quickstart and Examples
7.7.5 Concepts
7.7.6 Installing/Configuring
7.7.7 Predefined Constants
7.7.8 Mysqlnd_ms Functions
7.7.9 Change History
7.8 Mysqlnd query result cache plugin
7.8.1 Key Features
7.8.2 Limitations
7.8.3 On the name
7.8.4 Quickstart and Examples
7.8.5 Installing/Configuring
7.8.6 Predefined Constants
7.8.7 mysqlnd_qc Functions
7.8.8 Change History
7.9 Mysqlnd user handler plugin
7.9.1 Security considerations
7.9.2 Documentation note
7.9.3 On the name
7.9.4 Quickstart and Examples
7.9.5 Installing/Configuring
7.9.6 Predefined Constants
7.9.7 The MysqlndUhConnection class
7.9.8 The MysqlndUhPreparedStatement class
7.9.9 Mysqlnd_uh Functions
7.9.10 Change History
7.10 Mysqlnd connection multiplexing plugin
7.10.1 Key Features
7.10.2 Limitations
7.10.3 About the name mysqlnd_mux
7.10.4 Concepts
7.10.5 Installing/Configuring
7.10.6 Predefined Constants
7.10.7 Change History
7.11 Mysqlnd Memcache plugin
7.11.1 Key Features
7.11.2 Limitations
7.11.3 On the name
7.11.4 Quickstart and Examples
7.11.5 Installing/Configuring
7.11.6 Predefined Constants
7.11.7 Mysqlnd_memcache Functions
7.11.8 Change History
7.12 Common Problems with MySQL and PHP