[Embedded Server] Specify config params for embedded server

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for MySQL in Delphi and C++Builder
Post Reply
fduenas
Posts: 23
Joined: Fri 16 Dec 2005 20:55

[Embedded Server] Specify config params for embedded server

Post by fduenas » Mon 25 Aug 2008 09:31

Hi In latets builds i have tried to specify startup params for the dbxMDA Mysql Embedded server, using the Params property of the TSQLconnection or with the my.ini|my.cnf in executables folder but it seems it doesn't read the startup config. This is needed for example to specify the default language, chartsets, working data folder, base dir, disable innodb, etc.

How can this be achieved?

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 27 Aug 2008 11:59

You should use the TCRSQLConnection component instead of TSQLConnection.
For quick converting TSQLConnection in TCRSQLConnection you can use the "Convert to TCRSQLConnection" menu of component pop-up menu.

fduenas
Posts: 23
Joined: Fri 16 Dec 2005 20:55

Post by fduenas » Sat 06 Sep 2008 19:28

So doing doing this will make that i can configure the embedded server? for example read the my.ini or my.cfg file residing in the excutable path so i can specify the BaseDir, DataDir, and Charsets folder system variable needed to start the embedded server?

I normally don't use the TSQLConnection, or any DBX express bative components, normally I use the AnyDAC Data Access components and use the DBX bridge using your driver. Is there a way I can specify to your DBX driver to use the my.ini file to read startup variables or please show me a way how to achieve this.

Thanks.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 08 Sep 2008 12:49

You can not specify the parameters of the Embedded connection using dbExpress driver. For this you should use the TMyEmbConnection component of MyDAC.
To specify parameters in the my.ini configuration file this file must be placed in the {Windows} directory.

fduenas
Posts: 23
Joined: Fri 16 Dec 2005 20:55

Post by fduenas » Thu 11 Sep 2008 23:00

Ok. So I understand if I want to use embedded connection with custom parameters using DbExpress connection i must put my.ini in the windows folder.

I think you should add a suggestion for enabling the driver to search first for a my.ini found on the same folder as the exe or dll, and then search in the windows folder, doing this we can have my.ini for each different application.

I think it can be a very functional suggestion and not difficult to be implemented by you.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 15 Sep 2008 07:20

We will investigate the possibility of adding this functionality in the near future.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 27 Nov 2008 08:16

Now a feature for setting the 'Params' option to specify the list of command line parameters for MySQL Embedded server is added in DbxMda. For this you should set the appropriate parameter of TCRSQLConnection, like this:

Code: Select all

TCRSQLConnection.Params.Values['Custom String'] := 'Params="--basedir=.'#13#10'--datadir=data"';
Note: besides other parameters, you can set the --basedir and --datadir parameters.
The --basedir parameter sets the base path for MySQL Embedded server. All paths are usually resolved relative to this.
The --datadir parameter sets the path to the data directory.
See MySQL Reference Manual for detailed description.

AngelusB
Posts: 11
Joined: Tue 20 Jan 2009 11:17

embedded MySQL parameters

Post by AngelusB » Tue 20 Jan 2009 15:47

I'm using Delphi2007 and driver DevartMySQLEmbedded (driver 4.40.13 12-Dec-08)
If I use "my.in" in "c:\windows" (as in C:\Program Files\Devart\DbxMda\Demos\Win32\Embedded), all is working perfect.

But I try to prevent my customers to install files in c:\windows (Vista problems), so I tried to use parameter settings in the TCRSQLConnection.

My "basedir" is the application's directory. "datadir" is a subdirectory of "basedir".

Before connecting to the database I have the code:

MyConnection.Params.Values['Custom String'] := 'Params="--basedir=.'#13#10'--datadir=data"';

But this doesn't work. The error message is something like '
A call to an mysql_server_init failed.
c:\mysql\share\english.sym - System can't find the path
etc.

What's wrong?

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 21 Jan 2009 13:04

Please make sure that you have privileges to create files in the data and data\database_name directories.

AngelusB
Posts: 11
Joined: Tue 20 Jan 2009 11:17

Post by AngelusB » Wed 21 Jan 2009 15:22

Dimon wrote:Please make sure that you have privileges to create files in the data and data\database_name directories.
I'm very sure that I have all privileges to that directories.

Something must be wrong with the syntax of the parameters. When I create the directory c:\mysql c:\mysql\data and c:\mysql\share etc. all is working perfect. So I guess the parameter string is incorrect. Did I use the right syntax?

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 23 Jan 2009 07:12

Please specify the exact version of your Embedded server.

AngelusB
Posts: 11
Joined: Tue 20 Jan 2009 11:17

Post by AngelusB » Mon 26 Jan 2009 15:00

It's a libmysqld.dll without version number, dated 2005-3-24. (3444 Kb).
I downloaded this file some time ago.

And now the good news:
I made a new download from http://www.dlldll.com/downdll/3057.html and that solved the problem. Everything is working fine now.

Thank you pointing my attention to the embedded server version.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 27 Jan 2009 09:47

It is good to see that this problem has been solved.

fduenas
Posts: 23
Joined: Fri 16 Dec 2005 20:55

Post by fduenas » Mon 02 Feb 2009 08:09

Its good to see there are ways to specify params for the mebedded server, now can there be a say to specify to use the my.ini file for configuration?, maybe also espeifying a param like:
params=--defaults-file=my.ini so paramaters can be taken by a configuration file.

In MySQL documentation it says membeddeds server can manage parametrs speciffied in [server]and [embedded] sections in the ini file.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 02 Feb 2009 13:18

You are right. To specify a configuration file you should set the defaults-file option of TCRSQLConnection, like this:

Code: Select all

TCRSQLConnection.Params.Values['Custom String'] := 'Params="--defaults-file=my.ini"';

Post Reply