Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Config File Questions
Sun, Nov 18 2007 8:29 PMPermanent Link

Damien Lewis
Hi,

   A couple of Newby(ish) questions regarding the Config File.

   I have just moved up to ElevateDB from the old V3 DBISAM and have not quite got my
head around the new Config File. I have been reading the doco and posts, but havent been
able to work out the answer to this one. I believe that the config file should be stored
in a common location, so that all databases from various applications/projects can be
centrally managed. Thats OK, however, when I want to deploy an application with only its
database, I dont want the info related to the other databases sent out, so the first
question is...

1. Do I need a second config file for a specific deployment only, and if so how do I
create one? If this is a stand alone/single user app, I imagine that best practice would
be to place it in the same folder as the database?

   I usually develop stand alone applications and dont normally need multiuser access, so
in the application I am writing, I want to have the database accessable from the directory
where the application is running. ie you could copy the application directory to another
location with all contents, and the program would still run and use the database in the
new location. (I like my apps portable, which amoungst other things, makes testing easy).

   I could do this in DBISAM easily, by using "ExtractFilePath(Application.EXEName)" to
get the path and then use it with something like this "dbMain.Directory := sDataPath;" and
the application finds the correct database before it opens. All is good.

2. So my second question is how would I do this using ElevateDB?

Note that I am using the Standard VCL version of ElevateDB (v1.06) with Delphi 2007.
Thanks in advance.

Regards,

Damien
Mon, Nov 19 2007 2:27 AMPermanent Link

"Harry de Boer"
Damien,

Just create the configfile on the fly:

procedure TForm1.EDBEngineBeforeStart(Sender: TObject);
begin
 EDBEngine.ConfigPath:=ExtractFilePath(Application.ExeName);
 EDBEngine.TempTablesPath:=EDBEngine.GetTempTablesPath;
 EDBSession.LoginUser := 'Administrator';
 EDBSession.LoginPassword := 'EDBDefault';
 EDBDatabase.Database := 'Test';
end;

Set the dbpath:

procedure TForm1.FormCreate(Sender: TObject);
begin
 EDBengine.Active := FALSE;
 with EDBConfigQuery do begin
   Open;
   if Recordcount = 0 then begin
     Close;
     SQL.Text:='CREATE DATABASE "Test" PATH '+
                QuotedStr(ExtractFilePath(Application.ExeName)+'database');
     ExecSQL;
   end;
 end;
end;

Regards, Harry


"Damien Lewis" <Damien@PreciseIT.com> schreef in bericht
news:F38966C3-135E-44D9-A835-01C0FE996478@news.elevatesoft.com...
> Hi,
>
>     A couple of Newby(ish) questions regarding the Config File.
>
>     I have just moved up to ElevateDB from the old V3 DBISAM and have not
quite got my
> head around the new Config File. I have been reading the doco and posts,
but havent been
> able to work out the answer to this one. I believe that the config file
should be stored
> in a common location, so that all databases from various
applications/projects can be
> centrally managed. Thats OK, however, when I want to deploy an application
with only its
> database, I dont want the info related to the other databases sent out, so
the first
> question is...
>
> 1. Do I need a second config file for a specific deployment only, and if
so how do I
> create one? If this is a stand alone/single user app, I imagine that best
practice would
> be to place it in the same folder as the database?
>
>     I usually develop stand alone applications and dont normally need
multiuser access, so
> in the application I am writing, I want to have the database accessable
from the directory
> where the application is running. ie you could copy the application
directory to another
> location with all contents, and the program would still run and use the
database in the
> new location. (I like my apps portable, which amoungst other things, makes
testing easy).
>
>     I could do this in DBISAM easily, by using
"ExtractFilePath(Application.EXEName)" to
> get the path and then use it with something like this "dbMain.Directory :=
sDataPath;" and
> the application finds the correct database before it opens. All is good.
>
> 2. So my second question is how would I do this using ElevateDB?
>
> Note that I am using the Standard VCL version of ElevateDB (v1.06) with
Delphi 2007.
> Thanks in advance.
>
> Regards,
>
> Damien
>

Mon, Nov 19 2007 3:11 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Damien,

<< I have just moved up to ElevateDB from the old V3 DBISAM and have not
quite got my head around the new Config File. I have been reading the doco
and posts, but havent been able to work out the answer to this one. I
believe that the config file should be stored in a common location, so that
all databases from various applications/projects can be centrally managed.
>>

It's a personal issue, but you can choose to have 1 config file per
application or 1 config file for all applications.  Some find it much easier
to just have the former simply because it avoids the issue with mixing
application requirements in terms of security and database references.
Also, as of 1.06, the EDB Manager can use different config files for each
session, so you really have the flexibility now to go with the 1 config file
per application.

<< 1. Do I need a second config file for a specific deployment only, and if
so how do I create one? If this is a stand alone/single user app, I imagine
that best practice would be to place it in the same folder as the database?
>>

You can choose to ship a config file with the application, or create one
from scratch by simply setting the TEDBEngine.ConfigPath, or
TEDBSession.LocalConfigPath, see here:

http://www.elevatesoft.com/edb1d7_tedbengine_uselocalsessionenginesettings.htm

to the desired location, and then using the TEDBSession.Execute method to
execute the desired DDL statements to create all of the database(s),
user(s), etc.:

http://www.elevatesoft.com/edb1d7_creating_configuration_objects.htm

<< So my second question is how would I do this using ElevateDB? >>

See here:

http://www.elevatesoft.com/edb_faqt_2.htm

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Nov 20 2007 3:21 AMPermanent Link

Damien Lewis
Gentlemen,

Thank you for the feedback, much appreciated.

I will have a play with the things you have suggested.

Tim, personally I like the idea of the one config file per app. It suits my needs better,
but I can see value in both approaches.

Regards,

Damien


"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

Damien,

<< I have just moved up to ElevateDB from the old V3 DBISAM and have not
quite got my head around the new Config File. I have been reading the doco
and posts, but havent been able to work out the answer to this one. I
believe that the config file should be stored in a common location, so that
all databases from various applications/projects can be centrally managed.
>>

It's a personal issue, but you can choose to have 1 config file per
application or 1 config file for all applications.  Some find it much easier
to just have the former simply because it avoids the issue with mixing
application requirements in terms of security and database references.
Also, as of 1.06, the EDB Manager can use different config files for each
session, so you really have the flexibility now to go with the 1 config file
per application.

<< 1. Do I need a second config file for a specific deployment only, and if
so how do I create one? If this is a stand alone/single user app, I imagine
that best practice would be to place it in the same folder as the database?
>>

You can choose to ship a config file with the application, or create one
from scratch by simply setting the TEDBEngine.ConfigPath, or
TEDBSession.LocalConfigPath, see here:

http://www.elevatesoft.com/edb1d7_tedbengine_uselocalsessionenginesettings.htm

to the desired location, and then using the TEDBSession.Execute method to
execute the desired DDL statements to create all of the database(s),
user(s), etc.:

http://www.elevatesoft.com/edb1d7_creating_configuration_objects.htm

<< So my second question is how would I do this using ElevateDB? >>

See here:

http://www.elevatesoft.com/edb_faqt_2.htm

--
Tim Young
Elevate Software
www.elevatesoft.com

Image