MySQL Connector/NET Developer Guide

2y ago
26 Views
3 Downloads
1.27 MB
162 Pages
Last View : 2m ago
Last Download : 3m ago
Upload by : Julia Hutchens
Transcription

MySQL Connector/NET Developer Guide

AbstractThis manual describes how to install and configure MySQL Connector/NET, the connector that enables .NETapplications 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, including licensing information, see the Preface and Legal Notices.For help with using MySQL, please visit the MySQL Forums, where you can discuss your issues with other MySQLusers.Document generated on: 2021-05-13 (revision: 69754)

Table of ContentsPreface and Legal Notices . v1 Introduction to MySQL Connector/NET . 12 Connector/NET Versions . 33 Connector/NET Installation . 73.1 Installing Connector/NET on Windows . 73.1.1 Installing Connector/NET Using MySQL Installer . 73.1.2 Installing Connector/NET Using the Standalone Installer . 73.1.3 Installing Connector/NET Using NuGet . 83.2 Installing Connector/NET on Unix with Mono . 103.3 Installing Connector/NET from Source . 104 Connector/NET Connections . 134.1 Creating a Connector/NET Connection String . 134.2 Managing a Connection Pool in Connector/NET . 164.3 Handling Connection Errors . 174.4 Connector/NET 8.0 Connection Options Reference . 185 Connector/NET Programming . 335.1 Overview of Connector/NET Authentication . 345.1.1 Using the Windows Native Authentication Plugin . 355.1.2 Writing a Custom Authentication Plugin . 355.2 Using GetSchema on a Connection . 395.3 Using MySqlCommand . 415.4 Using Connector/NET with Table Caching . 425.5 Preparing Statements in Connector/NET . 425.6 Accessing Stored Procedures with Connector/NET . 435.6.1 Using Stored Routines from Connector/NET . 445.7 Handling BLOB Data With Connector/NET . 475.7.1 Preparing the MySQL Server . 475.7.2 Writing a File to the Database . 485.7.3 Reading a BLOB from the Database to a File on Disk . 495.8 Asynchronous Methods . 515.9 Using the Connector/NET Interceptor Classes . 575.10 Handling Date and Time Information in Connector/NET . 595.10.1 Fractional Seconds . 595.10.2 Problems when Using Invalid Dates . 605.10.3 Restricting Invalid Dates . 605.10.4 Handling Invalid Dates . 605.10.5 Handling NULL Dates . 605.11 Using the MySqlBulkLoader Class . 615.12 Using the Connector/NET Trace Source Object . 625.12.1 Viewing MySQL Trace Information . 635.12.2 Building Custom Listeners . 665.13 Binary and Nonbinary Issues . 675.14 Character Set Considerations for Connector/NET . 685.15 Using Connector/NET with Crystal Reports . 685.15.1 Creating a Data Source . 685.15.2 Creating the Report . 705.15.3 Displaying the Report . 705.16 Working with Partial Trust / Medium Trust . 735.16.1 Evolution of Partial Trust Support Across Connector/NET Versions . 735.16.2 Configuring Partial Trust with Connector/NET Library Installed in GAC . 745.16.3 Configuring Partial Trust with Connector/NET Library Not Installed in GAC . 75iii

MySQL Connector/NET Developer Guide6 Connector/NET Tutorials . 776.1 Tutorial: An Introduction to Connector/NET Programming . 776.1.1 The MySqlConnection Object . 776.1.2 The MySqlCommand Object . 786.1.3 Working with Decoupled Data . 816.1.4 Working with Parameters . 846.1.5 Working with Stored Procedures . 856.2 ASP.NET Provider Model and Tutorials . 876.2.1 Tutorial: Connector/NET ASP.NET Membership and Role Provider . 896.2.2 Tutorial: Connector/NET ASP.NET Profile Provider . 926.2.3 Tutorial: Web Parts Personalization Provider . 956.2.4 Tutorial: Simple Membership Web Provider . 996.3 Tutorial: Using an Entity Framework Entity as a Windows Forms Data Source . 1046.4 Tutorial: Data Binding in ASP.NET Using LINQ on Entities . 1126.5 Tutorial: Generating MySQL DDL from an Entity Framework Model . 1156.6 Tutorial: Basic CRUD Operations with Connector/NET . 1166.7 Tutorial: Configuring SSL with Connector/NET . 1196.7.1 Using PEM Certificates in Connector/NET . 1206.7.2 Using PFX Certificates in Connector/NET . 1206.8 Tutorial: Using MySqlScript . 1227 Connector/NET for Entity Framework . 1277.1 Entity Framework 6 Support . 1277.2 Entity Framework Core Support . 1337.2.1 Creating a Database with Code First in EF Core . 1357.2.2 Scaffolding an Existing Database in EF Core . 1387.2.3 Configuring Character Sets and Collations in EF Core . 1418 Connector/NET API Reference . 1438.1 Microsoft.EntityFrameworkCore Namespace . 1438.2 MySql.Data.EntityFramework Namespace . 1438.3 MySql.Data.MySqlClient Namespace . 1448.4 MySql.Data.MySqlClient.Authentication Namespace . 1478.5 MySql.Data.MySqlClient.Interceptors Namespace . 1488.6 MySql.Data.MySqlClient.Memcached Namespace . 1488.7 MySql.Data.MySqlClient.Replication Namespace . 1488.8 MySql.Data.Types Namespace . 1498.9 MySql.EntityFrameworkCore Namespace . 1498.10 MySql.Web Namespace . 1519 Connector/NET Support . 1539.1 Connector/NET Community Support . 1539.2 How to Report Connector/NET Problems or Bugs . 15310 Connector/NET FAQ . 155iv

Preface and Legal NoticesThis is the developer guide for MySQL Connector/NET.Licensing information.This product may include third-party software, used under license. MySQLConnector/NET Community License Information User Manual has information about licenses relating toConnector/NET community releases up to and including version 7.0. MySQL Connector/NET CommercialLicense Information User Manual has information about licenses relating to Connector/NET commercialreleases up to and including version 7.0. MySQL Connector/NET 8.0 Community License Information UserManual has information about licenses relating to Connector/NET community releases in the 8.0 releaseseries. MySQL Connector/NET 8.0 Commercial License Information User Manual has information aboutlicenses relating to Connector/NET commercial releases in the 8.0 release series.Legal NoticesCopyright 2004, 2021, Oracle and/or its affiliates.This software and related documentation are provided under a license agreement containing restrictionson use and disclosure and are protected by intellectual property laws. Except as expressly permittedin your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast,modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by anymeans. Reverse engineering, disassembly, or decompilation of this software, unless required by law forinteroperability, is prohibited.The information contained herein is subject to change without notice and is not warranted to be error-free.If you find any errors, please report them to us in writing.If this is software or related documentation that is delivered to the U.S. Government or anyone licensing iton behalf of the U.S. Government, then the following notice is applicable:U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integratedsoftware, any programs embedded, installed or activated on delivered hardware, and modifications ofsuch programs) and Oracle computer documentation or other Oracle data delivered to or accessed byU.S. Government end users are "commercial computer software" or "commercial computer softwaredocumentation" pursuant to the applicable Federal Acquisition Regulation and agency-specificsupplemental regulations. As such, the use, reproduction, duplication, release, display, disclosure,modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including anyoperating system, integrated software, any programs embedded, installed or activated on deliveredhardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracledata, is subject to the rights and limitations specified in the license contained in the applicable contract.The terms governing the U.S. Government's use of Oracle cloud services are defined by the applicablecontract for such services. No other rights are granted to the U.S. Government.This software or hardware is developed for general use in a variety of information managementapplications. It is not developed or intended for use in any inherently dangerous applications, includingapplications that may create a risk of personal injury. If you use this software or hardware in dangerousapplications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and othermeasures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damagescaused by use of this software or hardware in dangerous applications.Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarksof their respective owners.Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarksare used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD,v

Documentation AccessibilityEpyc, and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is aregistered trademark of The Open Group.This software or hardware and documentation may provide access to or information about content,products, and services from third parties. Oracle Corporation and its affiliates are not responsible for andexpressly disclaim all warranties of any kind with respect to third-party content, products, and servicesunless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and itsaffiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use ofthird-party content, products, or services, except as set forth in an applicable agreement between you andOracle.This documentation is NOT distributed under a GPL license. Use of this documentation is subject to thefollowing terms:You may create a printed copy of this documentation solely for your own personal use. Conversion to otherformats is allowed as long as the actual content is not altered or edited in any way. You shall not publishor distribute this documentation in any form or on any media, except if you distribute the documentation ina manner similar to how Oracle disseminates it (that is, electronically for download on a Web site with thesoftware) or on a CD-ROM or similar medium, provided however that the documentation is disseminatedtogether with the software on the same medium. Any other use, such as any dissemination of printedcopies or use of this documentation, in whole or in part, in another publication, requires the prior writtenconsent from an authorized representative of Oracle. Oracle and/or its affiliates reserve any and all rightsto this documentation not expressly granted above.Documentation AccessibilityFor information about Oracle's commitment to accessibility, visit the Oracle Accessibility Program ility/.Access to Oracle Support for AccessibilityOracle customers that have purchased support have access to electronic support through My OracleSupport. For information, y/learning-support.html#support-tab.vi

Chapter 1 Introduction to MySQL Connector/NETMySQL Connector/NET enables you to develop .NET applications that require secure, high-performancedata connectivity with MySQL. It implements the required ADO.NET interfaces and integrates intoADO.NET-aware tools. You can build applications using your choice of .NET languages. Connector/NETis a fully managed ADO.NET data provider written in 100% pure C#. It does not use the MySQL C clientlibrary.Connector/NET source code and tests are available from the NuGet Gallery and GitHub. For notesdetailing the changes in each release of Connector/NET, see MySQL Connector/NET Release Notes.Connector/NET includes full support for: Features provided by MySQL Server, up to and including the MySQL 8.0 release series. MySQL as a document store (NoSQL), along with X Protocol connection support to access MySQL datausing X Plugin ports. Large-packet support for sending and receiving rows and BLOB values up to 2 gigabytes in size. Protocol compression, which enables compressing the data stream between the client and server. Connections using TCP/IP sockets, named pipes, or shared memory on Windows. Connections using TCP/IP sockets or Unix sockets on Unix. Encrypted connections using: TLSv1.2 protocol over TCP/IP with Connector/NET 8.0.11 and later. TLSv1.3 protocol over TCP/IP with Connector/NET 8.0.20 and later. .NET Standard and runs on the Universal Windows Platform (UWP) .NET implementation. Entity Framework 6 and Entity Framework Core to migrate data to and from MySQL data tables. The Open Source Mono framework developed by Novell.Connector/NET supports Microsoft Visual Studio 2013, 2015, 2017, and 2019, although the extent ofsupport may be limited depending on the versions of Connector/NET and Visual Studio you use. Fordetails, see Chapter 2, Connector/NET Versions.Key Topics For connection string properties when using the MySqlConnection class, see Section 4.4, “Connector/NET 8.0 Connection Options Reference”.1

2

Chapter 2 Connector/NET VersionsThere are two Connector/NET release series described in th

This is the developer guide for MySQL Connector/NET. Licensing information. This product may include third-party software, used under license. MySQL Connector/NET Community License Information User Manual has information about licenses relating to Connector/NET community releases up to and including version

Related Documents:

MySQL for Excel is a 32-bit add-in for Microsoft Excel, which you can install and run on Microsoft Windows. MySQL for Excel is not compatible with Linux or macOS. MySQL for Excel can interact with MySQL Workbench to simplify the management of MySQL connections when both MySQL client tools are installed.

Lifetime Support Oracle Premier Support Oracle Product Certifications MySQL Enterprise High Availability MySQL Enterprise Security MySQL Enterprise Scalability MySQL Enterprise Backup MySQL Enterprise Monitor/Query Analyzer MySQL Workbench MySQL Enterprise Edition. 11 MySQL Database

This manual describes how to install and configure MySQL Connector/Python, a self-contained Python driver for communicating with MySQL servers, and how to use it to develop database applications. MySQL Connector/Python 8.0 is highly recommended for use with MySQL Server 8.0, 5.7, and 5.6.

Various forms of mysQL exist, such as oracle mysQL, mariadb, Percona server for mysQL, Galera cluster for mysQL, and Galera cluster for mariadb. oracle mysQL community edition is a freely downloadable version. commercial

MySQL PHP Syntax MySQL works very well in combination of various programming languages like PERL, C, C , JAVA and PHP. Out of these languages, PHP is the most popular one because of its web application development capabilities. PHP provides various functions to access MySQL database and to manipulate data records inside MySQL database.

Configure MySQL Download the latest version of MySQL www.dev.mysql.com The default Apple install has errors Supposed to be fixed in 10.4.4 update Install Package, Startup Item, and Preference Pane Reboot server MySQL Administrator GUI application to edit MySQL users and settings Cocoa MySQL GUI application to edit .

MySQL Performance Tuning &KDSWHU 10 MySQL settings to tune DIWHULQVWDOODWLRQ Fortunately crash recovery performance has improved a lot since MySQL 5.5 so you can now have good write performance and fast crash recovery. Until MySQL 5.5 the total redo log size was limited to 4GB (the default is to have 2 log files). This has been lifted in MySQL 5.6.

2013 AMC 8 Problems Problem 1 Amma wants to arrange her model cars in rows with exactly 6 cars in each row. She now has 23 model cars. What is the smallest number of additional cars she must buy in order to be able to arrange all her cars this way? Solution Problem 2 A sign at the fish market says, "50% off, today only: half-pound packages for just 3 per package." What is the regular price .