Embedded connection parameters

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
andrea.m86
Posts: 25
Joined: Thu 26 May 2011 10:36

Embedded connection parameters

Post by andrea.m86 » Fri 10 Jun 2011 09:11

Hi.
I need to connect a TMyConnectio object to a mysql server embedded.
Everything is ok if i set the parameters 'datadir' and 'basedir' in a my.ini file placed in the C:/windows directory, but i would like to know if it's possible to set this parameters in other way, at run time.
In other words I don't want my component to read the my.ini file, but i need to set the basedir and datadir parameters. Is it possible? Any suggestion?
Thanks

AndreyZ

Post by AndreyZ » Fri 10 Jun 2011 12:35

Hello,

To set the basedir and datadir parameters at run-time, you should use the TMyEmbConnection component. Here is a code example:

Code: Select all

MyEmbConnection.BaseDir := 'basedir';
MyEmbConnection.DataDir := 'datadir';
MyEmbConnection.Database := 'databasename';
MyEmbConnection.LoginPrompt := False;
MyEmbConnection.Connect;

andrea.m86
Posts: 25
Joined: Thu 26 May 2011 10:36

Post by andrea.m86 » Fri 10 Jun 2011 13:47

Yes. But I need to use TMyConnection!

AndreyZ

Post by AndreyZ » Fri 10 Jun 2011 14:02

Unfortunately, there is no way to set these parameters at run-time using the TMyConnection component.

Post Reply