MySql

wwBusiness also supports the MySql Open Source database as one of the data providers. You can download the latest MySql Server and the OleDb and ODBC drivers from here:

http://www.mysql.com/downloads/

There are a actually several ways to access MySql from .Net in general:

  • OleDb
  • Odbc
  • Managed .Net Drivers

You can use all three approaches with wwBusiness. However, the last is the only one that provides reliable operation as the OleDb and ODBC drivers have a number of problems with data type conversions and lack of useful error reporting.

The wwDataMySql class

The wwBusiness classes include a wwDataMySql class which can utilize the ByteFX managed MySql assemblies. To use this class you must do the following:

  • Download the the ByteFx ADO.Net Managed Provider from www.ByteFx.com
    You can download these free drivers from: http://www.bytefx.com/DotData.aspx

  • Open the wwDataMySql project
    Open this project which is seperately compiled to allow for dynamic loading of the MySql providers without any hard links in your application. As a result of this you need to copy the various assembly files to your applications assembly or bin directory. The DLLs required will be
    • wwDataMySql.dll
    • ByteFx.SqlClient.Dll
    • ICSharpCode.SharpZipLib.Dll

  • Add a reference to the Assemblies
    The assemblies are ByteFx.SqlClient.Dll and ICSharpCode.SharpZipLib.Dll where the latter is not required as a reference but must reside in your binary path for the application.

  • Set up the constructor and connection string
    In order for the business object to find the data source provide the ConnectType of MySql and provide an appropriate connection string for your MySql server.

    public busCustomer()
    {
    	this.Tablename = "wws_customers";
    	this.ConnectType = ServerTypes.MySql;
    	this.ConnectionString = "Server=RASNOTEBOOK;DATABASE=WebStore;User ID=WebStore;PASSWORD=supersecretion;";
    }

    As always normally you'll want to set both of those values from the App.Configuration options. The explicit string above is used here for clarity only.


Note:
wwBusiness supports MySql. However, due to data type issues we have not provided a version of a MySql database that works with the Web Store at this time.


Issues we've found

The driver and class combination works well together, but if you're mixing or converting from existing systems (especially SQL Server) you will find a number of type conversion issues. It appears it doesn't translate Bool values - it uses TinyInt which are treated as byte values that can't be coerced into a boolean value. Text values and nulls too behave differently than they do in Sql Server. The bottom line is that if you start from scratch with MySql you can check for proper types from the start and just work around these issues (such as always making sure you use numeric comparisons instead of bools), but if you're porting an existing application from SQL Server there will be a number of changes required. For this reason MySql support is not provided for the Web Store with Data.

© West Wind Technologies, 1996-2018 • Updated: 08/23/04
Comment or report problem with topic