Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Migrator in Code?
Sat, Jul 9 2011 6:47 AMPermanent Link

newuser

Hi
I want to create migrator in Code (migrator from ado with C#)
so I`ve created TEDBEngineManager engineManager;
                 TEDBLocalSessionManager localSessionManager;
                 TEDBDatabaseManager dataBaseManager;
                 TEDBMigrator migrator = new TEDBMigrator();
and assign needed object to each other like bellow

localSessionManager = new TEDBLocalSessionManager(engineManager);
engineManager.AddSessionManager(localSessionManager);
localSessionManager.Open( ...,...);
localSessionManager.LOgin(...);
TEDBDatabaseContainer databaseContainter = new TEDBDatabaseContainer(); so on...
and create a database
then create a migrator
everything works until here and  I can see them in ElevateDB Manager
but when I`m trying to migrate database by migrator.BeginMigrate(); I got error
"{System.NullReferenceException: Object reference not set to an instance of an object.
  at Elevate.ElevateDB.Data.Engine.TEDBConfig.get_Path()
  at Elevate.ElevateDB.Data.Engine.TEDBModule.GetModulePath()
  at Elevate.ElevateDB.Data.Engine.TEDBModule.get_ModulePath()
  at Elevate.ElevateDB.Data.Engine.TEDBModule.LoadModuleInstance()
  at Elevate.ElevateDB.Data.Engine.TEDBModule.LoadModule(Int32 TypeOfModule)
  at Elevate.ElevateDB.Data.Engine.TEDBMigrator.BeginMigrate()"

how to fix that up?
would you please give me a sample C# code here (or Delphi, etc)
actually I couldn`t find a manual referencing to use elevatedb  in .net code with samples.
Sat, Jul 9 2011 8:43 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

I'm a VCL user and did my migrations a couple of years ago so I'm taking a guess here. ElevateDB does not allow NULL as a primary key or part of a primary key. Do you have any of those in your tables? If so that would explain the error.

Roy Lambert
Sat, Jul 9 2011 9:33 AMPermanent Link

newuser

Roy Lambert wrote:

I'm a VCL user and did my migrations a couple of years ago so I'm taking a guess here. ElevateDB does not allow NULL as a primary key or part of a primary key. Do you have any of those in your tables? If so that would explain the error.

Roy Lambert


Thank you for reply
actually that`s not a problem
because migration done in ElevateDB Manager, and I have to it in Code.
I think I have to set some parameters for TEDBMigrate or TEDBModule, but I don`t know which and how
Sun, Jul 10 2011 12:46 PMPermanent Link

newuser

would you please write sample code of migration
Thanks
Mon, Jul 11 2011 3:26 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Have a look in the manual there are some examples there. You can also search the newsgroups. There have been similar postings and some good answers.

Roy Lambert [Team Elevate]
Fri, Jul 15 2011 1:24 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< I want to create migrator in Code (migrator from ado with C#)
so I`ve created TEDBEngineManager engineManager;
                 TEDBLocalSessionManager localSessionManager;
                 TEDBDatabaseManager dataBaseManager;
                 TEDBMigrator migrator = new TEDBMigrator();
and assign needed object to each other like bellow >>

Do you realize that you're using the low-level objects of the engine
directly ?  Usually, in .NET you'll use the classes/objects that are part of
ADO.NET - EDBConnection, EDBCommand, etc., and the basic flow is the same as
with any other ADO.NET data provider - you set up the connection with a
connection string, you open the connection, you set up the SQL command, and
then you execute the command.  For migration, you would simply execute the
MIGRATE DATABASE statement using an EDBCommand.

<< would you please give me a sample C# code here (or Delphi, etc) >>

The general information on the necessary SQL statements to migrate databases
is here:

http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=Migrating_Databases

<< actually I couldn`t find a manual referencing to use elevatedb  in .net
code with samples. >>

This is because 98% of the EDB data provider is the same as any other data
provider.  The EDB-specific properties/methods are noted in the manual, as
described here:

http://www.elevatesoft.com/manual?action=viewtopic&id=edb2dac&topic=Introduction_Reference

--
Tim Young
Elevate Software
www.elevatesoft.com


Wed, Jul 20 2011 9:13 AMPermanent Link

newuser

I know that simplest way for migration is to execute migrator command like bellow
"MIGRATE DATABASE FROM ..." and then execute();
it`s simple and fast, but every time  it`s give me error after a while that migration is in progress,
errors that says "expected SELECT, UPDATE ,.... but instead found some character like ',' and and so on" or some other errors,

here is my workflow for migration in .NET
Creating DataBase, (CREATE DATABASE ...    execute)
Creating Migrator, (CREATE MIGRATOR "ADO" ...   execute)
Executing "MIGRATE DATABASE FROM ADO..."

the migration starts, but after a while errors stops the migration,


the other way is to create a lite "elevatedb manager" in .NET like to provide in delphi (I guess), to automate this process
but this way has it`s difficulties like I asked in another post
link of that
http://www.elevatesoft.com/forums?action=view&category=edb&id=edb_general&msg=13539&page=1
Mon, Jul 25 2011 2:03 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< I know that simplest way for migration is to execute migrator command
like bellow
"MIGRATE DATABASE FROM ..." and then execute();
it`s simple and fast, but every time  it`s give me error after a while that
migration is in progress,
errors that says "expected SELECT, UPDATE ,.... but instead found some
character like ',' and and so on" or some other errors, >>

If you're getting an error during the migration, then please send me the
database that you're trying to migrate and I'll take a look.  Please be sure
to include all necessary files for the source database.

<< the other way is to create a lite "elevatedb manager" in .NET like to
provide in delphi (I guess), to automate this process >>

There's no reason to create a different ElevateDB Manager - the
functionality is all the same, and the engine is the same.

--
Tim Young
Elevate Software
www.elevatesoft.com
Image