1. Home
  2. Docs
  3. Getting Started
  4. Installation
  5. How to setup using MySql Database

How to setup using MySql Database

dotnet Report Builder is setup to use MS SQL database by default, however it can be switched out to use a different database type. This article will cover how to switch dotnet Report to use MySql database.

All Database Connections and Data Operations happen in the front end code which is open source. The Setup Controller uses OleDbConnection and the Report Controller uses SqlConnection. We would need to replace both with MySqlConnection.

First step to use MySql Database is to install “MySql.Data” nuget package in the project you have installed the dotnetreport nuget package.

Next is to replace the code using other connectors with MySql connector. Open up Setup Controller and Report Controller, and switch out the line:

using (var conn = new MySqlConnection(connString))

with:

using (OleDbConnection conn = new OleDbConnection(connString))

You would also have to make a couple of other small code changes, which are detailed here in this git branch.

Final step is to make sure that the connection string is formatted correctly for MySql.

Was this article helpful to you? Yes No

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *