Icon Migrating a DBISAM Database Using Code

The following steps will guide you through migrating a database from DBISAM format to ElevateDB format using the DBISAM migrators provided with ElevateDB.

1. Make sure that the DBISAM migrator modules (DLLs) are registered in the configuration file. The DBISAM migrator modules provided with ElevateDB are:

ModuleDescription
edbmigratedbisam1DBISAM Version 1.x migrator module
edbmigratedbisam2DBISAM Version 2.x migrator module
edbmigratedbisam3DBISAM Version 3.x migrator module
edbmigratedbisam4DBISAM Version 4.x migrator module

You can find these migrator modules as part of the ElevateDB additional software (EDB-ADD) installation in the \libs subdirectory under the main installation directory. There are ANSI and Unicode versions of each of the migrator modules that will work with both ANSI or Unicode sessions.

Information You can download the ElevateDB Additional Software and Utilities (EDB-ADD) installation from the Downloads page of the web site.

In order to register the required DBISAM migrator module(s), use the CREATE MODULE statement. You can use the TEDBSession Execute method to execute the statement:

// This example uses the default Session
// component to register the migrator module using the
// Execute method

with Session do
   Execute('CREATE MODULE "DBISAM4" '+
           'PATH ''C:\Program Files\ElevateDB 2 ADD\libs\edbmigratedbisam4\unicode\win32\edbmigratedbisam4.dll'''+
           'DESCRIPTION ''DBISAM 4 Migrator''');

2. Create a migrator for the desired migrator module using the CREATE MIGRATOR statement. You can use the TEDBSession Execute method to execute the statement:

// This example uses the default Session
// component to create the migrator using the
// Execute method

with Session do
   Execute('CREATE MIGRATOR "DBISAM4" '+
           'MODULE "DBISAM4" '+
           'DESCRIPTION ''DBISAM 4 Migrator''');

Information It's important that the MODULE referenced in the CREATE MIGRATOR statement matches the module that you registered first with the CREATE MODULE statement. You'll need to execute both statements for each migrator that you want to use with ElevateDB.

3. If necessary, create the ElevateDB database to use as the target database for the migration using the CREATE DATABASE statement. If you have already created the database or the database already exists, then you can skip this step. You can use the TEDBSession Execute method to execute the statement:

// This example uses the default Session
// component to create the database using the
// Execute method

with Session do
   Execute('CREATE DATABASE MyDatabase '+
           'PATH ''c:\mydatabase''');

4. Execute the MIGRATE DATABASE statement from the ElevateDB database that you just created, or that already existed. You can use the TEDBDatabase Execute method to execute the statement:

// This example uses an existing TEDBDatabase
// component to migrate the database using the
// Execute method

with MyDatabase do
   begin
   DatabaseName:='MyDatabase';
   Database:='MyDatabase';
   Execute('MIGRATE DATABASE FROM "DBISAM4" '+
           'USING DatabaseDirectory = ''c:\dbisamdata'''+
           'WITH DATA');
   end;

When the MIGRATE DATABASE statement is executed, the source DBISAM database directory should migrate to the current ElevateDB database. If you would like to display status and progress information during the migration, you can attach event handlers to the TEDBDatabase OnStatusMessage and OnProgress events.
Image