Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 20 total
Thread Backup with client / server application from the client program.
Wed, Oct 3 2012 7:25 AMPermanent Link

IQA

Hi All,

I'm using ElevateDB Unicode 2.10 build 1 in a client / server
application across a LAN network.

My question is regarding backing up... I want users to be able to backup
from the client program to a folder on their local PC, possibly even a
USB or external hard drive they have plugged in.

I dont want to force them to backup from the server, for one, most of
them wont even have access to the server and also it will be a case of,
out of site, out of mind.

Also there is an END OF DAY procedure they run from the client program
and I need it to do a backup at this stage anyway.

DBISAM was simple for this and had I had no problem in achieving it.

However it looks like I need to do something special for ElevateDB.

If anyone can point me in the right direction I would be grateful.

Cheers,

Phil.
Wed, Oct 3 2012 8:04 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Phil,

That’s not hard to do:

First, you have to create a Local Store (lets call it SrvBkStore) on the
server.
Then, every time a user wants to do a backup :

1. Using a stLocal session, create 2 stores:
 - A Remote Store pointing to SrvBkStore on the server
 - A Local Store pointing to a local directory (the final destination for
the backups)
If you are already using a local configuration file for something else, you
can use it to create the local stores, if not you can use an in-memory
configuration file and avoid messing with multiple configuration files in
disk.

2. Copy the backup file from the remote to the local store

3. Delete the backup file from the remote store

--
Fernando Dias
[Team Elevate]
Wed, Oct 3 2012 8:08 AMPermanent Link

IQA

> That’s not hard to do:
>
> First, you have to create a Local Store (lets call it SrvBkStore) on the
> server.
> Then, every time a user wants to do a backup :
>
> 1. Using a stLocal session, create 2 stores:
>   - A Remote Store pointing to SrvBkStore on the server
>   - A Local Store pointing to a local directory (the final destination
> for the backups)
> If you are already using a local configuration file for something else,
> you can use it to create the local stores, if not you can use an
> in-memory configuration file and avoid messing with multiple
> configuration files in disk.
>
> 2. Copy the backup file from the remote to the local store
>
> 3. Delete the backup file from the remote store
>
> --
> Fernando Dias
> [Team Elevate]

Thanks Fernando,

I was with you right up until you started talking about local
configuration files... Why would I have / need a local configuration
file and why if I dont use one would I need to create an 'in-memory'
configuration file?

Cheers,

Phil.
Wed, Oct 3 2012 8:24 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Phil,

<< Why would I have / need a local configuration file >>

You would already have a local configuration file if for any reason your
application was already using any stLocal session to connect to local
databases for example.
You are going to need one because you have to define 2 Local stores, and
Stores, as well as all the other objects (users, roles, jobs, databases) are
created in the Configuration File (EDBConfig.EDBCfg by default), so as you
are using Client/Server, you need a local configuration file or you are
going to create the stores on the server and not locally. The first store,
the one you have to create on the server, is going to be defined in the
configuration file of the server.

<< and why if I dont use one would I need to create an 'in-memory'
configuration file? >>

It doesn't have to be 'in-memory', it can be a regular 'on-disk'
configuration file, I only suggested it might be 'in-memory' to avoid the
creation of additional local files, as the local stores only have to exist
while the backup is being done.

--
Fernando Dias
[Team Elevate]
Wed, Oct 3 2012 8:34 AMPermanent Link

IQA

> You would already have a local configuration file if for any reason your
> application was already using any stLocal session to connect to local
> databases for example.
> You are going to need one because you have to define 2 Local stores, and
> Stores, as well as all the other objects (users, roles, jobs, databases)
> are created in the Configuration File (EDBConfig.EDBCfg by default), so
> as you are using Client/Server, you need a local configuration file or
> you are going to create the stores on the server and not locally. The
> first store, the one you have to create on the server, is going to be
> defined in the configuration file of the server.
>
> << and why if I dont use one would I need to create an 'in-memory'
> configuration file? >>
>
> It doesn't have to be 'in-memory', it can be a regular 'on-disk'
> configuration file, I only suggested it might be 'in-memory' to avoid
> the creation of additional local files, as the local stores only have to
> exist while the backup is being done.
>
> --
> Fernando Dias
> [Team Elevate]
>

Thanks Fernando,

This all seems like a bit of a mission and one that may open up a can of
worms at different sites and for support...
I almost wonder if I could just call a remote procedure from the client
to have the server make a backup at its default store I already have in
place and then just have the server send the backup file to the client
program using TCP/IP or something.

This seems to be one of those ElevateDB things that's not as open as DBISAM.

I'll have a play with my options before spending an unknown amount of
time / learning curve on creating multiple stores locally / remotely etc.

Thanks very much for your help, these are the best news groups, it has
great support and a good community of users.

Cheers,

Phil.


Wed, Oct 3 2012 10:05 AMPermanent Link

Raul

Team Elevate Team Elevate

Phil,

> DBISAM was simple for this and had I had no problem in achieving it.
How did you do this in DBISAM? AFAIK C/S backup would store the backup
file on the server filesystem  which is similar to how EDB works.

> However it looks like I need to do something special for ElevateDB.
The EDB simply introduces a concept of store which really is a just a
folder - idea of the store makes it easy to have EDB move files over the
network between stores.

> If anyone can point me in the right direction I would be grateful.
As Fernando mentioned you can have your client app in addition to having
a C/S connection create a another local session with 2 stores with one
of them referencing the server store where backup is and then use EDB to
move the file to local store (basically to a local folder). Nice thing
here is that it's all EDB with nothing else required.

If your clients are on a LAN and have file share access to the server
then you could also have the client simply make C/S backup to a store
that maps to server folder accessible from network and then copy the
file locally using UNC path for server and local path for destination
using client app.

Does your server happen to run any other services? If you have a web
server or FTP then you can have the backup store (server folder)
accessible thru one of those and your client would have to download the
backup file using either http or ftp client libraries.

Raul
Wed, Oct 3 2012 10:35 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Phil,

<< This all seems like a bit of a mission and one that may open up a can of worms at different sites and for support...>>
Believe me, it's not - it very reliable, I've been using this approach myself and it works very well.

<< I almost wonder if I could just call a remote procedure from the client to have the server make a backup at its default store I already have in place and then just have the server send the backup file to the client program using TCP/IP or something.>>
What you have described is exactly the same approach Smiley you just didn't go into the details on how to do that in EDB and I did. You even added en extra complexity factor that is not needed - you can just do the backup, there is no need for a remote procedure.

<< This seems to be one of those ElevateDB things that's not as open as DBISAM.
On the contrary.
If you were using C/S with DBISAM, backups would also have been stored on the server, not the client, just like EDB.


<< I'll have a play with my options before spending an unknown amount of time / learning curve on creating multiple stores locally / remotely etc.>>

Then, I'm sorry to say, you are going to miss the best of EDB Smiley
I agree with you that configuration files can be a bit confusing at first, but hey, no pain no gain Smiley
Seriously, it's not that hard. Let's see..

--- At the server -------------------------
Creating the local store for backups:
  CREATE STORE "SrvBkStore" AS LOCAL PATH 'D:\UsersBackups'


--- At the Client --------------------------
Creating the local store:
  CREATE STORE "LocalBK" AS LOCAL PATH 'D:\UserBackups'

Creating the remote store:
   CREATE STORE "RemoteBkStore" AS REMOTE ADDRESS '192.168.1.10' PORT 12010
     USER "Administrator" PASSWORD 'xxxxxxxx'
      STORE "SrvBkStore"

---- Doing the backup ------------------------
BACKUP DATABASE "YourDatabaseName"
  AS "TheNameYouWant"
  TO STORE "SrvBkStore"
  INCLUDE CATALOG

---- Copying it to the local store -------------
COPY FILE
  "YourDatabaseName.EDBBkp" IN STORE "RemoteBkStore"
  TO
  "YourDatabaseName.EDBBkp" IN STORE "LocalBK"



--
Fernando Dias
[Team Elevate]
Wed, Oct 3 2012 10:39 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Phil


Another approach, if you don't have any data that needs encrypting for security reasons, is to use the EXPORT feature. It produces CSV files and one advantage is that if you change your file structures you can (with a bit of wiggling) still use the backups which might not be the case with a proper backup.

The procedure below shows how I do it

procedure TExporterForm.AdvGlowButton4Click(Sender: TObject);
var
Cntr: integer;
StoreName: string;
Existing: boolean;
begin
if Destination.Text <> '' then begin
 Destination.Text := IncludeTrailingPathDelimiter(Destination.Text);
 if HHuac.ACT(-1, True) then begin
  KeepOn := True;
  if not DirectoryExists(Destination.Text) then begin
   if nlhMessageDlg('The specified directory does not exist. Do you want it creating?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
    KeepOn := ForceDirectories(Destination.Text);
   end else KeepOn := False;
  end;
  if KeepOn then begin
   Qry.Close;
   Qry.SQL.Text := 'SELECT Name FROM Configuration.Stores WHERE Path = ' + QuotedStr(Destination.Text) + ' OR Path = ' + QuotedStr(ExcludeTrailingPathDelimiter(Destination.Text));
   Qry.ExecSQL;
   ProgressBar.Position := 0;
   ProgressBar.Update;
   if Qry.RecordCount > 0 then begin
    Existing := True;
    StoreName := Qry.FieldByName(F_Name).AsString;
   end else begin
    Existing := False;
    StoreName := 'TfRExport';
    try
     dm.TfRSession.Execute('CREATE STORE "' + StoreName + '" AS LOCAL PATH ' + QuotedStr(Destination.Text));
    except
     dm.TfRSession.Execute('ALTER STORE "TfRExport" AS LOCAL PATH ' + QuotedStr(Destination.Text));
    end;
   end;
   AdvGlowButton4.Visible := False;
   AdvGlowButton3.Visible := True;
   SelectAll.Visible := False;
   SelectNone.Visible := False;
   Update;
   for Cntr := 0 to Tables.Items.Count - 1 do begin
    ProgressBar.Format := 'Exporting ' + Tables.Items[Cntr] + ' %3.0d percent';
    Application.ProcessMessages;
    if KeepOn then begin
     ProgressBar.Position := 0;
     ProgressBar.Update;
     Qry.Close;
     if Tables.Checked[Cntr] then begin
      if FileExists(Destination.Text + Tables.Items[Cntr] + ExportFileExtn) then DeleteFile(Destination.Text + Tables.Items[Cntr] + ExportFileExtn);
      Qry.SQL.Text := 'EXPORT TABLE "' + Tables.Items[Cntr] + '" TO "' + Tables.Items[Cntr] + ExportFileExtn + '" IN STORE "' + StoreName + '"';
      if WithHeaders.Checked then Qry.SQL.Add('WITH HEADERS');
      Qry.ExecSQL;
     end;
     Tables.Checked[Cntr] := False;
     Update;
    end;
   end;
   DoDBCleanup;
   ProgressBar.Position := 0;
   if not Existing then begin
    dm.TfRSession.Execute('DROP STORE "TfRExport" KEEP CONTENTS');
   end;
   nlhMessageDlg('Export finished.', mtWarning, [mbOK], 0);
   Close;
  end;
 end;
end else nlhMessageDlg('No destination directory specified.', mtError, [mbOK], 0);
end;

Roy Lambert
Wed, Oct 3 2012 7:16 PMPermanent Link

IQA

Thanks for all your suggestions / examples and help Fernando, Raul and Roy.

I think your right Fernando, it's not that hard, but just another chunk
of time and another thing to do to get the application ready for test phase.

I think I'll look at having a permanent store setup by the server app
and then one permanent virtual remote store on the client app pointing
to the server store... Then the local client will just create a
temporary store when it needs to backup to say a USB that's been plugged
in and do the backup / copy file from virtual to temp store.

I think that's the best way, will just have to crack on and get it working.

Cheers and as always much appreciated.

Phil.
Wed, Oct 3 2012 8:54 PMPermanent Link

IQA

> Thanks for all your suggestions / examples and help Fernando, Raul and Roy.
>
> I think your right Fernando, it's not that hard, but just another chunk
> of time and another thing to do to get the application ready for test
> phase.
>
> I think I'll look at having a permanent store setup by the server app
> and then one permanent virtual remote store on the client app pointing
> to the server store... Then the local client will just create a
> temporary store when it needs to backup to say a USB that's been plugged
> in and do the backup / copy file from virtual to temp store.
>
> I think that's the best way, will just have to crack on and get it working.
>
> Cheers and as always much appreciated.
>
> Phil.
>

Quick question, to do with the above, I have dropped an additional
TEDBSession in the DataModule of the client app so I can create my local
and virtual STORES.

I've set the sessions...

LocalConfigPath
LocalTempTablesPath

And when I connect it I get the #409 The configuration path is empty error.

I read up and now find I need to ADD a TEDBEngine component to my client
program, will this go and effect the multitude of other stuff already
setup for client / server thats in place? Or is there a way around this
so I don't have to add an Engine component onto the form?

Thanks,

Phil.

Page 1 of 2Next Page »
Jump to Page:  1 2
Image