test

This tutorial covers how to use a MySQL database in conjunction with the DotNetNuke (DNN) content management system. Typically DotNetNuke relies on Microsoft SQL Server, but there are times when you may not wish to use the default database engine. Enter the DotConnect MySQL connector.



“MySQL data provider” from DotConnect (http://www.devart.com) is used by DotNetNuke modules to communicate with MySQL databases. Before it goes through the MySQL database, it passes through the DotConnect MySQL ADO.NET driver. Bear in mind that due to the lack of support of DotNetNuke for other databases such as MySQL, your implementation may be prone to technical problems and compatibility issues.

System Requirements

DotNetNuke will be installed into one of the following system and installer requirements:

1.) ASP.NET in Windows.  If you are using Visual Studio or Visual Web developer tools, then the ASP.NET platform is already installed in Windows. Note that this tutorial is not tested to work in a Mono environment (ASP.NET on Linux)

2) DotNetNuke_04.07.00 – you need to download it here: http://dotnetnuke.codeplex.com/releases/view/20987 . DotConnect MySQL data provider for DotNetNuke currently supports DotNetNuke version 4.07.00. Other versions are not yet supported. This version runs on ASP.NET 2.0 and not 3.5. You will need to know this later.

3) MySQL database on your Windows computer – if you do not have MySQL installed, you can install XAMPP, which includes a MySQL database. You can read this tutorial for details: Install XAMPP on Windows . Note: This tutorial is tested on MySQL version 5.1.30.

4) Visual Web Developer Express 2008 – this is the free version of Visual Studio for developing websites.

5) DotConnect for MySQL ADO.NET driver – you need to download it here: http://www.devart.com/dotconnect/mysql/download.html. Make sure to download the “dotConnect for MySQL 6.10 Professional Trial” which is around 42.2MB.

5) DotNetNuke Data Provider for MySQL – you need to download it here: http://www.devart.com/dotconnect/mysql/download.html – scroll down until you will see: “DotNetNuke Data Provider for MySQL”.

{mospagebreak title=Create A DotNetNuke MySQL Database}

Step 1: Create Your DotNetNuke MySQL Database

1.) After installing XAMPP on Windows, go to All Programs – Apache Friends – XAMPP – XAMPP Control Panel. Make sure both Apache and MySQL are running (see screenshot below):



2.) Create a MySQL Database for DotNetNuke installation. Go to this URL: http://localhost/phpmyadmin/

3.) Login using your root MySQL username and password. The username is usually "root", while the password changes depending on what you are using during your XAMPP installation.

4.) After logging in, go under "Create new database", and enter dnn_database as the database name, then click the "Create" button (see screenshot below):



 If you see the message: "Database dnn_database has been created", you know that it has installed successfully. Do not yet create tables. Let the Dotnetnuke installation do that for you.

5.) Click "Exit" to sign-out from phpMyAdmin; close the browser. The MySQL database is ready to be used with DotNetNuke.

Step2: Install dotConnect for MySQL 6.10 Professional Trial

1.) Close all programs and double click dcmysql.exe to launch the installer.
2.) Follow the installation procedures and make sure you select “Minimal Installation”
3.) Finally, click Install.
4.) If it asks to download any files after installation, just close it.
5.) DotConnect for MySQL is now ready to be used with DotNetNuke.

Note that this is a trial version and will expire 30 days after use. After that, if you are happy with this connector, you can purchase a license.

Step3: Prepare the DotNetNuke Files for Installation

1.) Right click on the DotNetNuke_04.07.00_Install.zip package and click "Extract to DotNetNuke_04.07.00_Install."

Do not delete the zip package after extraction. You might need it in case something goes wrong.

2. Once extracted rename the folder "dnnmysql".
3.) Right click on mysqldnn.zip and choose “Extract to mysqldnn”.
4.) Go inside the mysqldnn folder, press control-A to select all files and folders, then copy and paste all of the content to dnnmysql folder of DotNetNuke. Bear in mind that some files will be overwritten so just click “Yes to all” to overwrite them. This is how the dnnmysql folder will look after integration:



5.) Copy the dnnmysql folder to your ASP.NET local development folders, accessible by Visual Web Developer Express. For example the path should be:

L:aspdotnetprojectsdnnmysql

{mospagebreak title=Configuring DotNetNuke}

Step4: Edit DotNetNuke Configuration files in Visual Web Developer

1.) Launch Visual Web Developer Express.
2.) Go to File – Open Web Site.
3.) Under “File System” locate the dnnmysql project folder.
4.) Click Open. You might see a warning that says:

The Website is configured to run on the .NET Framework version 2.0. Do you want to upgrade the web site to use the .NET framework version 3.5? (You can change the target version later by using the Project properties dialog box.

 Make sure “Do the same for all .NET framework2 2.0 Webs in this solution” is checked and then click NO.

5.) The project will then open in Visual Web Developer Express.
6.) In the Solution Explorer, look for "DevartMySql-DNN-4.7.0.0.config" file. Double click to edit the file.

7.) Find this line:

<add name="SiteMySqlServer" connectionString="User Id=root;Password=root;Database=;Unicode=true" />


Replace it with (make sure the MySQL connection strings are correct, e.g. username and password):

<add name="SiteMySqlServer" connectionString="User Id=root;Password=your_mysql_root_password;Database=dnn_database;Host=localhost;Unicode=true" />


8.) Find this line:

<add key="SiteMySqlServer" value="User Id=root;Password=root;Database=;Unicode=true" />


Replace it with:

<add key="SiteMySqlServer" value="User Id=root;Password=your_mysql_root_password;Database=dnn_database;Host=localhost;Unicode=true" />

9.) In Visual Web Developer Express. Go to Tools – Choose Toolbox items – Under .NET Framework Components click the "Assembly name" column to sort the name alphabetically.

Look for "Devart.Data.MySql" entry as well as "Devart.Data" entry. Write down the versions of each assembly: (see the screenshot below)



Devart.Data.MySQL version is 6.10.126.0 and Devart.Data version is 5.0.227.0.

10.) Now in the "DevartMySql-DNN-4.7.0.0.config" file, look for these lines:

<assemblyIdentity name="Devart.Data.MySql" publicKeyToken="09af7300eec23701" culture="neutral"/>
<bindingRedirect oldVersion="5.0.1.0-6.0.10.65535" newVersion="5.20.29.0"/>


Replace the version number 5.20.29.0 with the exact Devart.Data.Mysql version you obtained in step 9. Example:

<assemblyIdentity name="Devart.Data.MySql" publicKeyToken="09af7300eec23701" culture="neutral"/>
<bindingRedirect oldVersion="5.0.1.0-6.0.10.65535" newVersion="6.10.126.0"/>


11.) Find these lines:

<assemblyIdentity name="Devart.Data" publicKeyToken="09af7300eec23701" culture="neutral" />
<bindingRedirect oldVersion="5.0.1.0-5.0.110.65535" newVersion="5.0.1.0" />

Replace the version number 5.0.1.0 with the Devart.Data version you obtained in step 9. Example:

<assemblyIdentity name="Devart.Data" publicKeyToken="09af7300eec23701" culture="neutral" />
<bindingRedirect oldVersion="5.0.1.0-5.0.110.65535" newVersion="5.0.227.0" />

12.) Save all changes made to the DevartMySql-DNN-4.7.0.0.config file.
13.) Delete the current web.config file in Solution Explorer. This is the web.config included with the DotNetNuke version 04.07.00 installation package.

14.) Rename DevartMySql-DNN-4.7.0.0.config to web.config. This will become the new web.config file for DotNetNuke that is configured to work with the MySQL database. Close the project and exit Visual Web Developer Express.

Step5: Run the DotNetNuke Installation Wizard

1.) Now that everything has been configured, you are ready to run the Installation Wizard for DotNetNuke.

2.) Launch Visual Web Developer Express again and open the dnnmysql project folder.

3.) Go to Default.aspx.

4.) Go to File – View in Browser.

5.) You should not see any errors; instead you will see the installation screen, shown in the screenshot below:



Where Do I Get Help in Case of an Error During Installation?

Discussion on bugs and errors related to DotConnect MySQL data providers are beyond the scope of this article. Since DotConnect products are proprietary; if you are planning to avail their license; you can always go to their support forums located at: http://www.devart.com/forums/ and ask for technical help. It is important to report the installation errors with details so that it will be easily understood by them.
 

[gp-comments width="770" linklove="off" ]