How can you use MySql?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 年 前
You can use MySql in your nopcommerce project by using entlibcontrib library. Dowload link below.
http://entlibcontrib.codeplex.com/releases/view/38988
After the installation entlib modify your CreateConnection method like below in nopsqldatahelper class.
MySqlDatabase db = new MySqlDatabase(ConnectionString);
And you must modify web.config file like it in this file
http://entlibcontrib.codeplex.com/wikipage?title=MySqlDataProvider41
14 年 前
Hi,

Thanks for this post, I have been attempting to convert DB to MySql to cut down on overheads.

I'm running into all sorts of errors, for example: The value cannot be null or an empty string (connectionString) but its not empty, and another problem with the Public Key Token when I amend my web.config file to the one for MySqlProvider on CodePlex website as you specified.

Here are the sections of my files:

web.config file:

<?xml version="1.0"?>
<configuration>
  <configSections>
        <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null" />
      <section name="urlrewritingnet" requirePermission="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter"/>
  </configSections>
  <dataConfiguration defaultDatabase="NopSqlConnection">
    <providerMappings>
      <add databaseType="EntLibContrib.Data.MySql.MySqlDatabase, EntLibContrib.Data.MySql, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null" name="MySql.Data.MySqlClient" />
    </providerMappings>
  </dataConfiguration>
  <connectionStrings>
    <add name="NopSqlConnection" providerName="MySql.Data.MySqlClient" connectionString="data source=localhost;database=nopcommdb;uid=root;pwd=password" />
  </connectionStrings>

and my nopdatahelper section:

using EntLibContrib.Data.MySql;
using EntLibContrib.Data.MySql.Properties;
using MySql.Data.MySqlClient;

namespace NopSolutions.NopCommerce.Common.DAL
{
    /// <summary>
    /// Data helper class
    /// </summary>
    public class NopDataHelper
    {
        #region Methods
        /// <summary>
        /// Creates a connection to a data soruce
        /// </summary>
        /// <returns>Database instance</returns>
        public static MySqlDatabase CreateConnection()
        {
            string strCon = "Data Source=localhost;Database=nopcommdb;User Id=root;Password=password;"; // PUT THIS HERE INCASE IT WAS NOT CONNECTING TO WEB.CONFIG
            MySqlDatabase db = new MySqlDatabase(strCon);
            return db;
        }

Any Ideas???
14 年 前
Did you do this installing instructures:

Installing the Enterprise Library Contrib Project



There are two release files, one with the binaries only and the other with the full source code. These release files are standard zip compressed files and need to be expanded into a temporary folder e.g. C:\TEMP


Binaries-only Release entlibcontrib2010-01-bin.zip

After downloading the binaries only release, copy the binaries to the Microsoft Patterns and Practices Enterprise Library installation folder (typically %ProgramFiles%\Microsoft Enterprise Library 4.1 - October 2008\Bin\).
Note: These runtime extensions can be used with your code without first copying the files to the Enterprise Library installation folder if you wish, however any extensions to the Configuration Console (and Visual Studio integration) will not work until you do.

Full Source Code Release entlibcontrib2010-01-src.zip

After downloading the source release, to create the binaries you can run \Scripts\BuildAndCopyAssemblies.bat and copy the contents of the Enterprise Library Contrib \Bin\ folder to the Microsoft Patterns and Practices Enterprise Library installation directory (typically %ProgramFiles%\Microsoft Enterprise Library 4.1 - October 2008\Bin\).
Note: These runtime extensions can be used with your code without first copying the files to the Enterprise Library installation folder if you wish, however any extensions to the Configuration Console (and Visual Studio integration) will not work until you do.



Installing Instrumentation

For both release files, to install instrumentation you will need to run \Scripts\InstallServices.bat.This will install Event Sources, Performance Counters and WMI containers. Note: if you are using Vista then you will need to run this as an Administrator.
14 年 前
Thanks for the reply.

I have now done everything you have said in the last post but still get the same error:

The value can not be null or an empty string.
Parameter name: connectionString
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: The value can not be null or an empty string.
Parameter name: connectionString

Source Error:

Line 35:     {
Line 36:         #region Methods
Line 37:         /// <summary>
Line 38:         /// Creates a connection to a data soruce
Line 39:         /// </summary>


Source File: C:\Users\SolarDrift\Desktop\CodeProject_NopCommerceStore\NopCommerce\Nop.Common\DAL\NopDataHelper.cs    Line: 37


My Code is:

// MYSQL CONNECTOR
using MySql.Data.MySqlClient;
using MySql.Data.Types;
using EntLibContrib.Data.MySql;
using EntLibContrib.Data.MySql.Properties;

namespace NopSolutions.NopCommerce.Common.DAL
{
    /// <summary>
    /// Data helper class
    /// </summary>
    public class NopDataHelper
    {
        #region Methods
        /// <summary>
        /// Creates a connection to a data soruce
        /// </summary>
        /// <returns>Database instance</returns>
        public static MySqlDatabase CreateConnection()
        {
            string strConnection = "Data Source=localhost;Database=nopcommdb;Uid=root;Pwd=aa4322aa;";
            MySqlDatabase db = new MySqlDatabase(strConnection);
            return db;
        }

Am I right to leave NopConfig out fo the web.config, and bypass this altogether and just go direct to NopDataHelper.cs?
14 年 前
Ignore Last post, It works now, thanks for your help, been trying to get this to work for months now !! GREAT !!
14 年 前
So it looks like some people are having success using MySql.  Can someone provide a blank MySql database backup or scripts to create the MySql database for NopCommerce?  If not, can someone provide some insight into converting the database from Sql Server to MySql?

Thanks,
Natalie
14 年 前
Hey Natalie, I have read Integration nopCommerce and MySQL
My freind is testing it now, there is a "performance test"
14 年 前
Can anyone share with me the detailed steps on how to make it run on MySQL? Thanks a lot.
14 年 前
Hi All,


I am working on the conversion, it seems like working fine so far but I am sure there are a lot of bugs still need to be caught. And I haven't started working on the XML data type conversion.

Feel free to share your experience with me whoever has succeed or not on the nopcommer mysql conversion.

Ken
14 年 前
I have managed to convert NopCommerce V1.50 to MySql, including the Database, but am having an issue with the NOP_splitstring_to_table Function called from Nop_ProductLoadAllPaged. I have tracked down where the error is occurring from Nop_ProductLoadAllPaged and it is this line:

SELECT CAST(v_FilteredSpecs AS SIGNED INTEGER) FROM NOP_splitstring_to_table(v_FilteredSpecs,',');

It is thie bit: (v_FilteredSpecs,',') that s causing the error.

Please help !!

Thanks in advance,

Paul.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.