Overview
The MySQL Connector/NET
is a fully managed ADO.NET data provider written in pure C# which can be used to connect to MySQL, MariaDB, etc. databases.
Setting up the MySQL Connector/NET Data Provider in the .NET Standalone Report Designer
- Create a new .NET 8 Console Application project.
- Install the MySql.Data NuGet package to it and
build
the project. - Navigate to the
bin/Debug/net8.0
subdirectory of the project, and copy all assemblies there except for the assembly with the name of the project. - Paste the assemblies in the .NET Standalone Report Designer installation directory e.g.
C:\Program Files (x86)\Progress\Telerik Reporting 2024 Q3\Report Designer\.NET
. - Start the .NET Standalone Report Designer from the same directory and add a new SqlDataSource component which should trigger the SqlDataSource Wizard. The
MySQL
data provider should now be listed among the rest of the data providers when building a new connection.
Setting up the MySQL Connector/NET Data Provider in the .NET Framework Standalone Report Designer
Using MSI Installer
MySQL provides an x86 32-bit
MSI installer that will install the MySQL data provider and register it in the machine.config
- MySQL Community Downloads.
Using the Source Code
The MySQL Community Downloads page also offers the option of downloading the source code.
- Download the source code
.zip
- MySQL Community Downloads. - Extract it and navigate to the
v4.6.2
subdirectory. - Copy all of the content in the
v4.6.2
directory to the directory with the .NET Framework Standalone Report Designer -C:\Program Files (x86)\Progress\Telerik Reporting 2024 Q3\Report Designer\
. -
Open the
Telerik.ReportDesigner.exe.config
file in a text editor and add the following XML to register the MySQL data provider without installing<system.data> <DbProviderFactories> <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=9.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/> </DbProviderFactories> </system.data>
The example was made with version
9.0.0
of the MySQL data provider, correct the version number in the above snippet if a newer/older version was downloaded instead.
Setting up the MySQL Connector/NET Data Provider in .NET Applications
The MySQL Connector/NET data provider is automatically registered in the Telerik.Reporting.Processing.Data.DbProviderFactories
. To use this data provider, it should be enough to install the MySql.Data NuGet package to the project.
If the SqlDataSource component uses a shared
connection where it is retrieved from the configuration file of the project(e.g. appsettings.json
), the provider name must be specified in the connection. For example:
{
"ConnectionStrings":{
"mysql":{
"connectionString":"Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;",
"providerName":"MySql.Data.MySqlClient"
}
}
}
Web Report Designer
In the SqlDataSource Wizard of the Web Report Designer, on the first page, the Data Provider
must be MySql.Data.MySqlClient
, but the option is limited only to MySql.Data.
Since the engine cannot determine the type of the data provider by that name, it falls back to System.Data.SqlClient
and claims that "Port" is not a supported keyword
.
The workaround is to avoid using the SQL DataSource wizard and edit the data source properties directly in the Properties
grid.