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: 2024-12-18 (revision: 80547)


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.5.3 Authentication Support
2.5.4 OpenTelemetry Tracing Support
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 Compatibility with MySQL and Java Versions
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 Handling of Date-Time Values
3.5.7 Using Character Sets and Unicode
3.5.8 Using Query Attributes
3.5.9 Connecting Securely Using SSL
3.5.10 Connecting Using Unix Domain Sockets
3.5.11 Connecting Using Named Pipes
3.5.12 Connecting Using Various Authentication Methods
3.5.13 Using Source/Replica Replication with ReplicationConnection
3.5.14 Support for DNS SRV Records
3.5.15 Client Session State Tracker
3.5.16 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 Managing a Connection Pool in Connector/NET
4.4.3 Handling Connection Errors
4.4.4 Connector/NET Authentication
4.4.5 Connector/NET Connection Options Reference
4.5 Connector/NET Programming
4.5.1 Using GetSchema on a Connection
4.5.2 Using MySqlCommand
4.5.3 Using Connector/NET with Table Caching
4.5.4 Preparing Statements in Connector/NET
4.5.5 Creating and Calling Stored Procedures
4.5.6 Handling BLOB Data With Connector/NET
4.5.7 Working with Partial Trust / Medium Trust
4.5.8 Writing a Custom Authentication Plugin
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 Connector/NET Tracing
4.5.13 Using Connector/NET with Crystal Reports
4.5.14 Asynchronous Methods
4.5.15 Binary and Nonbinary Issues
4.5.16 Character Set Considerations for Connector/NET
4.6 Connector/NET Tutorials
4.6.1 Tutorial: An Introduction to Connector/NET Programming
4.6.2 ASP.NET Provider Model and Tutorials
4.6.3 Tutorial: Using an Entity Framework Entity as a Windows Forms Data Source
4.6.4 Tutorial: Data Binding in ASP.NET Using LINQ on Entities
4.6.5 Tutorial: Generating MySQL DDL from an Entity Framework Model
4.6.6 Tutorial: Basic CRUD Operations with Connector/NET
4.6.7 Tutorial: Configuring SSL with Connector/NET
4.6.8 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 MySql.Data.Common.DnsClient
4.8.2 MySql.Data.MySqlClient Namespace
4.8.3 MySql.Data.MySqlClient.Authentication Namespace
4.8.4 MySql.Data.MySqlClient.Interceptors Namespace
4.8.5 MySql.Data.MySqlClient.Replication Namespace
4.8.6 MySql.Data.Types Namespace
4.8.7 MySql.Data.EntityFramework Namespace
4.8.8 Microsoft.EntityFrameworkCore Namespace
4.8.9 MySql.EntityFrameworkCore 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 OpenTelemetry Tracing Support
5.5.9 Authentication Options
5.5.10 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
5.9.3 Connector/ODBC Version History
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 Logging
6.8.2 Telemetry Support
6.8.3 Asynchronous Connectivity
6.8.4 Connector/Python Connection Pooling
6.8.5 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