Page 1 of 1

Embedded connection parameters

Posted: Fri 10 Jun 2011 09:11
by andrea.m86
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

Posted: Fri 10 Jun 2011 12:35
by AndreyZ
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;

Posted: Fri 10 Jun 2011 13:47
by andrea.m86
Yes. But I need to use TMyConnection!

Posted: Fri 10 Jun 2011 14:02
by AndreyZ
Unfortunately, there is no way to set these parameters at run-time using the TMyConnection component.