Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 12 total
Thread Making Database Portable ...
Mon, Jun 2 2008 7:30 PMPermanent Link

Charalabos Michael
Hello,
  I have a database & configuration in the "database" folder.

  In order to make it portable i use the following code:
  var
    DatabasePath: String;
  ....
  DatabasePath := ExtractFilePath(Application.ExeName) + 'database\';

  dbEngine.ConfigPath := vDatabasePath;
  dbEngine.UseLocalSessionEngineSettings := True;
  dbSession.LocalConfigPath := vDatabasePath;
  dbSession.SessionType := stLocal;

  In my PC the database & configuration path is steady:
  eg. c:\projects\my project\database

  In end-user PC the database & configuration path is:
  c:\program files\my folder\my app\database

  So i set the database path in EDBManager to:
  ".\database" which it will work at runtime but
  isn't working in EDB Manager! (they tables open empty)

  Any ideas what "Path" to set into the Database & Session
  in EDBManager ?

Thank you in advance

--
Charalabos Michael - [Creation Power] - http://www.creationpower.gr
Mon, Jun 2 2008 7:31 PMPermanent Link

Charalabos Michael
Correction:
   var
     vDatabasePath: String;
   ....
   vDatabasePath := ExtractFilePath(Application.ExeName) + 'database\';

   dbEngine.ConfigPath := vDatabasePath;
   dbEngine.UseLocalSessionEngineSettings := True;
   dbSession.LocalConfigPath := vDatabasePath;
   dbSession.SessionType := stLocal;

--
Charalabos Michael - [Creation Power] - http://www.creationpower.gr
Tue, Jun 3 2008 2:59 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Charalabos


You need to use the full path name not a partial path.

Roy Lambert [Team Elevate]
Tue, Jun 3 2008 3:17 AMPermanent Link

Charalabos Michael
Hello Robert,

> You need to use the full path name not a partial path.

Ok, how i can change the full path at runtime then ?
(without modifying the database)

Thank you
--
Charalabos Michael - [Creation Power] - http://www.creationpower.gr
Tue, Jun 3 2008 5:22 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Charalabos


Robert! - how dare you! I don't look anything like him - I'm far prettier Smiley

With DBISAM there was only one path to bother about - the one in the database or table which pointed to the directory in which the data lived. In ElevateDB you have two paths to think about:

the configuration
the database

and its essential not to get these confused.

The code you use for setting the configuration path is correct. A bit overkill setting it in the engine and the session, but I do exactly the same.

For the database there is no way to change it without altering the database, however, its an absolute doddle eg:

dbSession.Execute('ALTER DATABASE "NLH-Live" PATH ''e:\hh dev\TfR\NLH\Live'' DESCRIPTION ''NLH Associates'');

Note double quotes round the database name NLH-Live and two single quotes around the path and description. All this does is alter the path and description (if you don't want a description use '''') and does nothing to the tables in the database.

Roy Lambert [Team Elevate]
Tue, Jun 3 2008 12:49 PMPermanent Link

Charalabos Michael
Hello Roy,

> Robert! - how dare you! I don't look anything like him - I'm far prettier Smiley

Smile

> For the database there is no way to change it without altering the database, however, its an absolute doddle eg:
>
> dbSession.Execute('ALTER DATABASE "NLH-Live" PATH ''e:\hh dev\TfR\NLH\Live'' DESCRIPTION ''NLH Associates'');
>
> Note double quotes round the database name NLH-Live and two single quotes around the path and description. All this does is alter the path and description (if you don't want a description use '''') and does nothing to the tables in the database.

Darn, and i thought that it was possible without altering the database
path! Frown

So every time a user send me the database for fixing or analysis or
whatever i must alter the path too ...

To Tim:
Why not introduce a LocalDatabasePath variable in order to avoid
altering the database path ?

Thank you

--
Charalabos Michael - [Creation Power] - http://www.creationpower.gr
Tue, Jun 3 2008 1:48 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Charalabos


>So every time a user send me the database for fixing or analysis or
>whatever i must alter the path too ...

Different question Smiley The answer is it depends. If your catalogs are the same then it should be possible to just copy his data into your directory, just ignore their catalog and let your's do the work.

If any of the table versions differ from yours you'll need their catalog as well.

Roy Lambert [Team Elevate]
Tue, Jun 3 2008 8:24 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< So every time a user send me the database for fixing or analysis or
whatever i must alter the path too ... >>

No, not at all.  The database path is stored in the configuration file, not
the database catalog.  Just have them send you the database catalog and
tables, and you can then just drop them into a directory of your choosing
that already is used by a pre-existing database.

For example, say that you have a database called "Test" that is set up to
use the c:\test directory as its path.  When you get the database catalog
and tables from the customer, just wipe out what already exists in that path
and copy in the files from the customer.   That's it.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Jun 4 2008 2:35 AMPermanent Link

"Ralf Bieber"
Tim Young [Elevate Software] wrote:

> No, not at all.  The database path is stored in the configuration
> file, not the database catalog.  Just have them send you the database
> catalog and tables, and you can then just drop them into a directory
> of your choosing that already is used by a pre-existing database.
>
> For example, say that you have a database called "Test" that is set
> up to use the c:\test directory as its path.  When you get the
> database catalog and tables from the customer, just wipe out what
> already exists in that path and copy in the files from the customer.
> That's it.

But when you have a application on an USB-Stick, then you must setting
the database catalog path and in the configuration file the database
path.
I think it is better for a easier handling, remove the database path
from the configurations file and make a extra property in database
component 'database-root-path'.

Ralf


--
Wed, Jun 4 2008 3:23 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ralf

>I think it is better for a easier handling, remove the database path
>from the configurations file and make a extra property in database
>component 'database-root-path'.

I liked the sound of the idea at first read, but as I thought about it I can see a lot of potential for confusion. Also it would then mean two operations to find out where the data is actually stored instead of one simple query as now (I'm assuming from the use of root path that you would have to store the remainder of the path somewhere else).

Roy Lambert [Team Elevate]
Page 1 of 2Next Page »
Jump to Page:  1 2
Image