![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 7 of 7 total |
![]() |
Mon, Apr 7 2008 11:44 AM | Permanent Link |
RB | Hi
Please could you point me in the right direction on how to migrate a BDE db to EDB using code? I plan to have this as part of the installer... I'm aware that you can run the following SQL: MIGRATE DATABASE FROM "BDE" USING "DatabaseName" = 'TestDB' WITH DATA Further info will be much appreciated. Cheers |
Mon, Apr 7 2008 1:09 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Ravinder,
<< Please could you point me in the right direction on how to migrate a BDE db to EDB using code? I plan to have this as part of the installer... >> Please see here for more information: http://www.elevatesoft.com/manual?action=mantopic&id=edb1sql&category=0&topic=14 You can also fine out how the EDB Manager sets up the migrators by looking at the EDB Manager source code in the main.pas unit for the EDB Manager project. You can get it here: http://www.elevatesoft.com/download?action=downinfo&producttype=edbadd&version=1 -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Apr 8 2008 5:18 AM | Permanent Link |
RB | Hi
Thanks for this. As part of the custom installer I will also need to create the EDB databases from scratch i.e. config db, etc. - is it possible to do this? "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote: Ravinder, << Please could you point me in the right direction on how to migrate a BDE db to EDB using code? I plan to have this as part of the installer... >> Please see here for more information: http://www.elevatesoft.com/manual?action=mantopic&id=edb1sql&category=0&topic=14 You can also fine out how the EDB Manager sets up the migrators by looking at the EDB Manager source code in the main.pas unit for the EDB Manager project. You can get it here: http://www.elevatesoft.com/download?action=downinfo&producttype=edbadd&version=1 -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Apr 8 2008 5:51 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | RB
You'll have to dig the appropriate bits out but here's the procedure I'm using to migrate from DBISAM V4 to ElevateDB. Its been run many times as I develop/modify what I want to do with the migrated app. Start by dropping a TEDBEngine, TEDBSession, TEDBDatabase onto your form procedure TForm1.ConvertToElevateDB; var Path: string; Cntr: integer; begin Path := IncludeTrailingBackslash(ExtractFilePath(Application.ExeName)); if FileExists(Path + 'edbmigratedbisam4.dll') then begin glProgress1.Visible := True; Memo1.Lines.Add('Converting to ElevateDB database format'); Memo1.Update; FilesToDelete(TfRLive, '*.EDB???'); // EDBTbl, EDBIdx, EDBblb if FileExists(Path + 'EDBConfig.EDBLog') then DeleteFile(Path + 'EDBConfig.EDBLog'); if FileExists(Path + 'EDBConfig.EDBCfg.Old') then DeleteFile(Path + 'EDBConfig.EDBCfg.Old'); if FileExists(Path + 'EDBConfig.EDBCfg') then DeleteFile(Path + 'EDBConfig.EDBCfg'); if FileExists(Path + 'EDBConfig.EDBLck') then DeleteFile(Path + 'EDBConfig.EDBLck'); with EDBSession do begin LocalConfigPath := Path; Users.Open; while not Users.Eof do begin try Execute('CREATE USER "' + Users.FieldByName('_ID').AsString + '" PASSWORD ' + QuotedStr(Decrypt(Users.FieldByName('_Check').AsString)) + ' DESCRIPTION ' + QuotedStr(Users.FieldByName('_Name').AsString)); Execute('GRANT "Administrators" TO "' + Users.FieldByName('_ID').AsString + '"'); except; end; Users.Next; end; Users.Close; Execute('CREATE MIGRATOR "DBISAM4" MODULE "edbmigratedbisam4" DESCRIPTION ''DBISAM 4 Migrator'''); Execute('CREATE DATABASE "' + CompanyCode.Text + '-Live" PATH ' + QuotedStr(TfRLive) + ' DESCRIPTION ' + QuotedStr(CompanyName.Text)); Execute('CREATE DATABASE "' + CompanyCode.Text + '-Archive" PATH ' + QuotedStr(TfRArchive) + ' DESCRIPTION ' + QuotedStr(CompanyName.Text + ' - Archived Data')); Execute('CREATE DATABASE "Memory" IN MEMORY'); end; with EDBDataBase do begin DatabaseName := CompanyCode.Text; Database := CompanyCode.Text + '-Live'; Execute('MIGRATE DATABASE FROM "DBISAM4" USING DatabaseDirectory = ' + QuotedStr(TfRLive) + 'WITH DATA'); end; with EDBSession do Execute('DROP MIGRATOR "DBISAM4"'); TranSesh.Close; for Cntr := 0 to ComponentCount - 1 do begin if Components[Cntr] is TDBISAMTable then TDBISAMTable(Components[Cntr]).Close else if Components[Cntr] is TDBISAMQuery then TDBISAMQuery(Components[Cntr]).Close; end; { Engine.Active := False; FilesToDelete(TfRLive, '*.dat'); FilesToDelete(TfRLive, '*.idx'); FilesToDelete(TfRLive, '*.blb'); FilesToDelete(TfRLive, '*.dbk'); FilesToDelete(TfRLive, '*.ibk'); FilesToDelete(TfRLive, '*.bbk'); FilesToDelete(TfRLive, '*.lck'); } with EDBSession do begin //close, swap users and alter administrator password // Execute('CREATE USER "TfRLogon" PASSWORD ''TfR Logon'' DESCRIPTION ''TfR Logon User'''); // Execute('DROP USER "Administrator"'); {ALTER USER "Administrator" PASSWORD 'Albert' DESCRIPTION 'Administrator User'} end; end else MessageDlg('migrator code is missing', mtError, [mbOK], 0); end; Roy Lambert [Team Elevate] |
Tue, Apr 8 2008 1:50 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Ravinder,
<< As part of the custom installer I will also need to create the EDB databases from scratch i.e. config db, etc. - is it possible to do this? >> Sure, look at the CDCollector sample application that comes with ElevateDB in the \examples subdirectory - it shows you how to set up everything when the application starts up. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Apr 15 2008 10:56 AM | Permanent Link |
RB | Hi
Thanks for the info. Using SQL to do the migration is fine but I need a way of showing the user some sort of progress visually... At the moment, once the SQL command is executed the installer app does not provide any status' on what is going on. Looking in EDBManger, I see it is able to tell the user as each table is migrated... how can I implement this for my installer app? Thanks "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote: Ravinder, << As part of the custom installer I will also need to create the EDB databases from scratch i.e. config db, etc. - is it possible to do this? >> Sure, look at the CDCollector sample application that comes with ElevateDB in the \examples subdirectory - it shows you how to set up everything when the application starts up. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Apr 15 2008 12:03 PM | Permanent Link |
Roy Lambert NLH Associates ![]() | Ravinder
You can use the database OnProgress and OnStatusMessage events eg with EDBDataBase do begin DatabaseName := CompanyCode.Text; Database := CompanyCode.Text + '-Live'; Execute('MIGRATE DATABASE FROM "DBISAM4" USING DatabaseDirectory = ' + QuotedStr(TfRLive) + 'WITH DATA'); end; procedure TForm1.EDBDatabaseProgress(Sender: TObject; PercentDone: Integer; var Continue: Boolean); begin glProgress1.Percent := PercentDone; glProgress1.Update; end; procedure TForm1.EDBDatabaseStatusMessage(Sender: TObject; const StatusMessage: string); var tbl: string; begin glProgress1.Percent := 0; if (SubFld(StatusMessage, ' ', 1)[1] <> 'C') and (0 = Pos('index', LowerCase(StatusMessage))) then begin Memo1.Lines.Add(' ' + StatusMessage); tbl := 'Transfering data into ' + SubFld(StatusMessage, ' ', 3); glProgress1.Caption := tbl + ' [%d%%]'; end else glProgress1.Caption := StatusMessage; glProgress1.Update; end; Roy Lambert [Team Elevate] |
This web page was last updated on Monday, July 1, 2024 at 03:00 AM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |