setting up Embedded in code

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Smitty McSmith
Posts: 2
Joined: Tue 23 Aug 2005 16:14

setting up Embedded in code

Post by Smitty McSmith » Tue 23 Aug 2005 16:24

how do i set up an embedded connection in code at runtime instead of design time?

what i have so far (but doesn't work obviously) is:

//---------------------------------------------------------------------------//
procedure TDBConnection.FormActivate(Sender: TObject);
begin
RetDatabase.BaseDir := 'C:/src_tc/ClientProjects/DC_PSJC/database';
RetDatabase.DataDir := 'C:/src_tc/ClientProjects/DC_PSJC/database/data';
RetDatabase.LoginPrompt := false;
RetDatabase.Username := 'root';
RetDatabase.ConnectionTimeout := 10;

RetDatabase.Connect;

RetDatabase.Database := 'dc_psjc';

RetDatabase.AfterConnect := DBConnectionDialog;
end;

procedure TDBConnection.DBConnectionDialog( Sender: TObject );
begin
showMessage( 'Connection: ' + BoolToStr( RetDatabase.Connected ) );
end;
//---------------------------------------------------------------------------//

RetDatabase is in a seperate file uHeader which is shared globaly between all the files in the project.
its initialized:

//---------------------------------------------------------------------------//
RetDatabase := TMyEmbConnection.Create( nil );
//---------------------------------------------------------------------------//


i get the error when it's being created, which is understandable because its in formactivate. The message is:

First chance exception at $7C81EB33. Exception class Exception with message 'A call to an mysql_server_init failed
C:\src_tc\ClientProjects\DC_PSJC\database\data\ibdata1 - The operation completed successfully'. Process DBConnection.exe (556)

what am i missing or doing wrong?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 25 Aug 2005 11:08

This message raises if MySQL Embedded Server cannot start and doesn't depend where TMyEmbConnection was created.

Smitty McSmith
Posts: 2
Joined: Tue 23 Aug 2005 16:14

Post by Smitty McSmith » Thu 25 Aug 2005 13:28

[quote="Ikar"]This message raises if MySQL Embedded Server cannot start and doesn't depend where TMyEmbConnection was created.[/quote]

hugh?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 25 Aug 2005 14:57

It seems, you set server options incorrectly. We cannot tell you more exactly without set of tests.

Post Reply