MySQL Connector/Net Developer Guide

Abstract

This manual describes how to install and configure MySQL Connector/Net, the driver that enables .NET applications to communicate with MySQL servers, and how to use it to develop database applications.

For notes detailing the changes in each release of Connector/Net, see MySQL Connector/Net Release Notes.

For legal information, see the Legal Notices.

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

For additional documentation on MySQL products, including translations of the documentation into other languages, and downloadable versions in variety of formats, including HTML and PDF formats, see the MySQL Documentation Library.

Licensing information.  This product may include third-party software, used under license. If you are using a Commercial release of MySQL Connector/Net, see this document for licensing information, including licensing information relating to third-party software that may be included in this Commercial release. If you are using a Community release of MySQL Connector/Net, see this document for licensing information, including licensing information relating to third-party software that may be included in this Community release.

Document generated on: 2016-09-16 (revision: 49023)


Table of Contents

Preface and Legal Notices
1 Introduction to MySQL Connector/Net
2 Connector/Net Versions
3 Connector/Net Installation
3.1 Installing Connector/Net on Windows
3.1.1 Installing Connector/Net Using MySQL Installer
3.1.2 Installing Connector/Net Using the Standalone Installer
3.2 Installing Connector/Net on Unix with Mono
3.3 Installing Connector/Net from the Source Code
4 Connector/Net Tutorials
4.1 Tutorial: An Introduction to Connector/Net Programming
4.1.1 The MySqlConnection Object
4.1.2 The MySqlCommand Object
4.1.3 Working with Decoupled Data
4.1.4 Working with Parameters
4.1.5 Working with Stored Procedures
4.2 Tutorial: MySQL Connector/Net ASP.NET Membership and Role Provider
4.3 Tutorial: MySQL Connector/Net ASP.NET Profile Provider
4.4 Tutorial: Web Parts Personalization Provider
4.5 Tutorial: Simple Membership Web Provider
4.5.1 Requirements
4.5.2 Creating and Configuring a New Project
4.5.3 Adding OAuth Authentication to a Project
4.6 Tutorial: Using an Entity Framework Entity as a Windows Forms Data Source
4.7 Tutorial: Databinding in ASP.NET Using LINQ on Entities
4.8 Tutorial: Using SSL with MySQL Connector/Net
4.9 Tutorial: Using MySqlScript
4.9.1 Using Delimiters with MySqlScript
4.10 Tutorial: Generating MySQL DDL from an Entity Framework Model
5 Connector/Net Programming
5.1 Connecting to MySQL Using Connector/Net
5.2 Creating a Connector/Net Connection String
5.2.1 Opening a Connection
5.2.2 Handling Connection Errors
5.2.3 Using GetSchema on a Connection
5.3 Using MySqlCommand
5.4 Using Connector/Net with Connection Pooling
5.5 Using the Windows Native Authentication Plugin
5.6 Writing a Custom Authentication Plugin
5.7 MySQL Fabric Support
5.8 Using Connector/Net with Table Caching
5.9 Using the Connector/Net with Prepared Statements
5.9.1 Preparing Statements in Connector/Net
5.10 Accessing Stored Procedures with Connector/Net
5.10.1 Using Stored Routines from Connector/Net
5.11 Handling BLOB Data With Connector/Net
5.11.1 Preparing the MySQL Server
5.11.2 Writing a File to the Database
5.11.3 Reading a BLOB from the Database to a File on Disk
5.12 Asynchronous methods
5.13 Using the Connector/Net Interceptor Classes
5.14 Handling Date and Time Information in Connector/Net
5.14.1 Fractional Seconds
5.14.2 Problems when Using Invalid Dates
5.14.3 Restricting Invalid Dates
5.14.4 Handling Invalid Dates
5.14.5 Handling NULL Dates
5.15 Using the MySqlBulkLoader Class
5.16 Using the MySQL Connector/Net Trace Source Object
5.16.1 Viewing MySQL Trace Information
5.16.2 Building Custom Listeners
5.17 Binary/Nonbinary Issues
5.18 Character Set Considerations for Connector/Net
5.19 Using Connector/Net with Crystal Reports
5.19.1 Creating a Data Source
5.19.2 Creating the Report
5.19.3 Displaying the Report
5.20 ASP.NET Provider Model
5.21 Working with Partial Trust / Medium Trust
5.21.1 Evolution of Partial Trust Support Across Connector/Net Versions
5.21.2 Configuring Partial Trust with Connector/Net Library Installed in GAC
5.21.3 Configuring Partial Trust with Connector/Net Library Not Installed in GAC
6 Connector/Net Connection String Options Reference
7 Connector/Net Support for Windows Store
8 EF5 Support
9 EF6 Support
10 Connector/Net API Reference
10.1 MySql.Data.MySqlClient Namespace
10.1.1 MySql.Data.MySqlClientHierarchy
10.1.2 BaseCommandInterceptor Class
10.1.3 BaseExceptionInterceptor Class
10.1.4 MySqlCommand Class
10.1.5 MySqlCommandBuilder Class
10.1.6 MySqlException Class
10.1.7 MySqlHelper Class
10.1.8 MySqlErrorCode Enumeration
10.2 MySql.Data.Types Namespace
10.2.1 MySql.Data.TypesHierarchy
10.2.2 MySqlConversionException Class
10.2.3 MySqlDateTime Class
10.2.4 IsValidDateTime Property
10.2.5 Millisecond Property
10.2.6 Minute Property
10.2.7 Month Property
10.2.8 Second Property
10.2.9 Year Property
10.2.10 MySqlDateTime.GetDateTime Method
10.2.11 MySqlDateTime.ToString Method
10.3 MySql.Data.MySqlClient.Memcached Namespace
10.3.1 BinaryClient Class
10.3.2 Client Class
10.3.3 TextClient Class
10.4 MySql.Data.MySqlClient.Replication Namespace
10.4.1 ReplicationManager Class
10.4.2 ReplicationRoundRobinServerGroup Class
10.4.3 ReplicationServer Class
10.4.4 ReplicationServerGroup Class
11 Connector/Net Support
11.1 Connector/Net Community Support
11.2 How to Report Connector/Net Problems or Bugs
12 Connector/Net FAQ