dotConnect for MySQL Documentation
In This Topic
    Using Embedded Server
    In This Topic

    Embedded server is an easy at installation server to be used by applications that do not require multi-user data access. As an example Embedded server can be used for money access machines, automatic cash desks, different electronic facilities and so on. Please refer to MySQL Reference Manual for more details about features and using of Embedded server. Also you can find an information about licensing Embedded server at MySQL Reference Manual.

    dotConnect for MySQL can work with MySQL Embedded server version 4.1 and higher. This feature is not available in Mobile Edition of dotConnect for MySQL.

    This topic covers important information on configuring and deploying applications that use Embedded server.

    This article consists of the following sections:

    Limitations

    Here are known restrictions of current Embedded server version. All of them are caused by the server itself, it is not a problem of dotConnect for MySQL. For troubleshooting tips refer to MySQL documentation.

    Installation

    To install Embedded server on your machine and use it in dotConnect for MySQL design-time you should:

    1. Download the server installation package from MySQL AB web site (http://dev.mysql.com/downloads/mysql/).
    2. Install the server.
    3. Create a directory for your Embedded server. This will be your "basedir" directory.
    4. Make sure you have libmysqld.dll available through PATH environment variable. Restart Visual Studio if you have it running after altering the PATH variable.
    5. Copy "share" folder from server installation to the basedir.
    6. Create folder for data inside the basedir directory. This is your "datadir" directory. You can copy here "mysql" folder from your server installation.
    7. Now you can use MySQL Embedded server.

    Configuration

    To use the Embedded server properly you have to configure the server. This can be done in two ways: either using my.ini file or specifying data as parameters in connection string.

    To use my.ini file you have to create it at the root Windows folder and fill its following sections:

    [Server] - common settings for MySQL usual and Embedded servers.

    [Embedded] - settings specific to Embedded server.

    [<Application exe-file name (with extension)>] - settings specific to particular application. You can obtain this string using AppDomain.CurrentDomain.FriendlyName expression.

    Details about list of settings you can find at MySQL Reference Manual.

    Minimal my.ini example:

    [embedded]
    basedir=c:/servers/embedded/
    datadir=c:/servers/embedded/data/
    

    According to this configuration, contents of 'share' folder can be found in the 'c:\servers\embedded\share\' path, data is located in the 'c:\servers\embedded\data\' folder. Notice use of forward slashes instead of backslashes.

    To use connection string for configuring Embedded server you have to include "Server Parameters" item in your list of parameters. The value of this parameter is a quoted string that includes server parameters preceded by two hyphens. The following example shows how to configure the server exactly as it is done earlier with my.ini file:

    "User Id=root; Server Parameters=\"--basedir=c:/servers/embedded/;--datadir=c:/servers/embedded/data/;\"; Embedded=True;";
    
    
    "User Id=root; Server Parameters=""--basedir=c:/servers/embedded/;--datadir=c:/servers/embedded/data/;""; Embedded=True;"
    
    

    Note that you can use other command-line parameters as well. They are covered in MySQL documentation.

    Distribution

    There are just two conditions for Embedded server to function in deployed application.

    First, libmysqld.dll file should be accessible for your executable file (see LoadLibrary function for details). It may be a good idea to distribute libmysqld.dll in the same folder with your application exe file.

    Second, the basedir and datadir variables must be set correctly. It does not matter how you do it - using my.ini or connection string. If the settings are invalid you will receive System.ApplicationException.

    See Also

    MySqlConnection.Embedded  | Devart.Data.MySql Namespace