Board index » delphi » Help-Database in a Remote Location: Where to put the data files

Help-Database in a Remote Location: Where to put the data files

I have written a small database app and want to know if I install it on another
machine, will the app still be looking for the .DB and .DBF files in the
directory structure it was seeking them from at the time of compilation?

For instance, the data files are in C:\DELPHI\WORK\APPLICAT\DATA on my hardrive.

If I install it on another machine, how can I compile the application so that
it will look for the application's data files in the application directory,..
(Wherever that may be..)

Thanks (Please respond with a message to my mailbox as well as the forum)
----
RKR

****************************************
E-Mail:  r...@primenet.com
****************************************

 

Re:Help-Database in a Remote Location: Where to put the data files


Quote
>If I install it on another machine, how can I compile
>the application so that
>it will look for the application's data files in the
>application directory,..
>(Wherever that may be..)

Here's what I do, put a database component somewhere in your project.
 Store the data directory to an ini file.  When the app starts, read
the path from the ini file, then update the database params using
like this

path=<put your string here>

then set all your tables active property to true.  If it is pointing
to the right place, it will work seamlessly.

In addition, I usually create the ini file with whatever installation
procedure I use, so it's right unless someone moves or copies the
files to a different location.

Hope this helps.

Mike

Re:Help-Database in a Remote Location: Where to put the data files


Quote
r...@primenet.com wrote:
>I have written a small database app and want to know if I install it on another
>machine, will the app still be looking for the .DB and .DBF files in the
>directory structure it was seeking them from at the time of compilation?

>For instance, the data files are in C:\DELPHI\WORK\APPLICAT\DATA on my hardrive.

>If I install it on another machine, how can I compile the application so that
>it will look for the application's data files in the application directory,..
>(Wherever that may be..)

If you hard coded the path in the database property i.e.
c:\app\data\myTable.db then you will have problems. If, on the other hand,
you created an alias in BDECfg. then you're off to the races. Your
applicaiton will use this alias for all database access. You need only set
the alias in BDECfg for each user.

BTW, make sure you place your tables on a drive with a letter higher than
E: otherwise you will bypass the file locking mechanism and end up with
corrupted tables in multi-user situations.

Ond other thing, be sure to use a TDatabase componet, that way you set the
alias only once for the application.

Michael Lant

Re:Help-Database in a Remote Location: Where to put the data files


In article <N.010296.173717...@ip225.sna.primenet.com>, r...@primenet.com
writes

Quote
>I have written a small database app and want to know if I install it on another
>machine, will the app still be looking for the .DB and .DBF files in the
>directory structure it was seeking them from at the time of compilation?

>For instance, the data files are in C:\DELPHI\WORK\APPLICAT\DATA on my hardrive.

>If I install it on another machine, how can I compile the application so that
>it will look for the application's data files in the application directory,..
>(Wherever that may be..)

An alternative is to use relative paths, i.e. .\DATA which will mean
that you can set up databases to be 'below' the application in the
appropriate directories. Provided you maintain this when transferring
the completed application all will be well without any changes, either
at design or run time, being required.

--
Richard Linsley Hood | Poole, Dorset UK | email: richar...@dakal.demon.co.uk
"Programming is mirroring the world, inside a computer"   Larry O'Brien 1991

Turnpike evaluation. For information, email: i...@turnpike.com

Re:Help-Database in a Remote Location: Where to put the data files


Quote
Michael Lant <ml...@xyberlynx.net> wrote:
>BTW, make sure you place your tables on a drive with a letter higher than
>E: otherwise you will bypass the file locking mechanism and end up with
>corrupted tables in multi-user situations.

Would you further explain this. Why can't a user USE a shared
directory as drive D: and not have a corrupted table? Is this true
under any Network OS? Or is it a "feature" of DOS's share?

Regards,

================================================
Michael F. Grimes              <Mi...@locul.com>
Lohnes and Culver Broadcast Consulting Engineers
8309 Cherry Lane                Laurel, MD 20707
VOICE: 1.410.776.4488        FAX: 1.410.776.4499

Re:Help-Database in a Remote Location: Where to put the data files


Quote
r...@primenet.com wrote:
>I have written a small database app and want to know if I install it on another
>machine, will the app still be looking for the .DB and .DBF files in the
>directory structure it was seeking them from at the time of compilation?
>For instance, the data files are in C:\DELPHI\WORK\APPLICAT\DATA on my hardrive.
>If I install it on another machine, how can I compile the application so that
>it will look for the application's data files in the application directory,..

If the data directory is a subdirectory or same as the application
directory, then simply give it a relative name ie "data\file".  Or you
could a registry entry to store the base directory of you application.
---
Bob Mallett
Remember: While the Arc was built by amateurs, it was professionals
          who built the Titanic - Richard Needham M.P.

Re:Help-Database in a Remote Location: Where to put the data files


Quote
r...@primenet.com writes:
> I have written a small database app and want to know if I install it on another
> machine, will the app still be looking for the .DB and .DBF files in the
> directory structure it was seeking them from at the time of compilation?

> For instance, the data files are in C:\DELPHI\WORK\APPLICAT\DATA on my hardrive.

> If I install it on another machine, how can I compile the application so that
> it will look for the application's data files in the application directory,..
> (Wherever that may be..)

> Thanks (Please respond with a message to my mailbox as well as the forum)
> ----
> RKR

> ****************************************
> E-Mail:  r...@primenet.com
> ****************************************

See ALIAS DEFINITION in DataBase Engine Configuration and set a ALIAS to the
location.

   Carlos Alberto.

Re:Help-Database in a Remote Location: Where to put the data files


Quote
In article <4cfd7m$...@lion.xyberlynx.net> Michael Lant <ml...@xyberlynx.net> writes:
>From: Michael Lant <ml...@xyberlynx.net>
>Subject: Re: Help-Database in a Remote Location: Where to put the data files
>Date: 4 Jan 1996 02:15:18 GMT
>r...@primenet.com wrote:
>>I have written a small database app and want to know if I install it on another
>>machine, will the app still be looking for the .DB and .DBF files in the
>>directory structure it was seeking them from at the time of compilation?

>>For instance, the data files are in C:\DELPHI\WORK\APPLICAT\DATA on my hardrive.

>>If I install it on another machine, how can I compile the application so that
>>it will look for the application's data files in the application directory,..
>>(Wherever that may be..)
>If you hard coded the path in the database property i.e.
>c:\app\data\myTable.db then you will have problems. If, on the other hand,
>you created an alias in BDECfg. then you're off to the races. Your
>applicaiton will use this alias for all database access. You need only set
>the alias in BDECfg for each user.
>BTW, make sure you place your tables on a drive with a letter higher than
>E: otherwise you will bypass the file locking mechanism and end up with
>corrupted tables in multi-user situations.
>Ond other thing, be sure to use a TDatabase componet, that way you set the
>alias only once for the application.
>Michael Lant

Alternatively you can set the Path= Parameter of the Database component and
avoid the Alias and BDE situation. I let the user set this value and write it
to the Application INI file. Its easier than having them mess with the
BDEConfig.

Cheers,

Matthew

Other Threads