setting up Embedded in code

setting up Embedded in code

Postby 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?
Smitty McSmith
 
Posts: 2
Joined: Tue 23 Aug 2005 16:14

Postby Ikar » Thu 25 Aug 2005 11:08

This message raises if MySQL Embedded Server cannot start and doesn't depend where TMyEmbConnection was created.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Postby 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?
Smitty McSmith
 
Posts: 2
Joined: Tue 23 Aug 2005 16:14

Postby Ikar » Thu 25 Aug 2005 14:57

It seems, you set server options incorrectly. We cannot tell you more exactly without set of tests.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56


Return to MySQL Data Access Components