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?
setting up Embedded in code
-
- Posts: 2
- Joined: Tue 23 Aug 2005 16:14