Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Cloning V3 C/S settings on different laptop
Tue, Aug 29 2006 11:58 AMPermanent Link

"John"
Hello,

I have installed and configured the server and admin tool on a PC.

I have now to install them on different PCs for making demonstration.

of couse i could configure it manually on each pc but with risk of errors.
Is there a way to copy the settings directly o othere's PC (for instance on
copying some configuration files) ?

thanks

John

Tue, Aug 29 2006 2:49 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

John,

<< I have installed and configured the server and admin tool on a PC.

I have now to install them on different PCs for making demonstration.

of couse i could configure it manually on each pc but with risk of
errors.Is there a way to copy the settings directly o othere's PC (for
instance on
copying some configuration files) ?  >>

Provided that the path names are all local (c: drive) and that the
directories that are referenced in the configuration are available on every
PC that you install the database server on, then you can just copy the
dbsrvr.scf file from the directory where the original dbsrvr.exe is
installed (by default, the <installdir>\servers\dbsrvr directory) to each PC
and that will do the trick.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Aug 30 2006 3:19 AMPermanent Link

"John"
Thanks Tim

Wed, Aug 30 2006 9:37 AMPermanent Link

"Scott Martin"
Another approach is to modify the server code to allow your installer
to configure the server. (INI file).

This works very good and is easy to impliment.

Regards,
Scott.

At the bottom of
procedure TMainForm.Initialize(Service: TService);

...

  if FileExists(pbPath.MainDir+'servercfg.INI') then begin
    SSIni := TIniFile.Create(pbPath.MainDir+'servercfg.INI');
    bFirstRun := SSIni.ReadBool('Program','FirstRun',False);
    //
    if bFirstRun then begin
      SSIni.WriteBool('Program','FirstRun',False);
      ImportServerInformation(False);
    end;
    SSIni.Free;
  end;


procedure TMainForm.ImportServerInformation(bPrompt: Boolean);
var
 SSIni: TIniFile;
 aProcList,aAuthorized,aBlocked: TStrings;
 //
 i: Integer;
 sUserName, sPassword, sUserDescription: String;
 sDBName, sDBDescription, sDBPath, sTempDirectory: String;
 bAdmin, bDBRights, bDenyLogins: Boolean;
 iMaxConnections, iConnectionTimeout, iDeadSessionInterval, iDeadSessionExpires, iMaxDeadSessions: Integer;

 sStarting, sEnding: String;

 sEventName, sEDescription, sEStarting, sEEnding, sEFrom, sEUntil: String;
 iERunType, iEEvery: Integer;

 aTempDays: TEventDays;
 aTempMonths: TEventMonths;

 aUserPermissions: TDatabaseRights;
 aProcRights: TProcedureRights;
begin
 if FileExists(pbPath.MainDir+'servercfg.INI') then begin
   if bPrompt then
     if MessageDlg('Import settings from servercfg.ini?',mtConfirmation,[mbYes,mbNo],0) = mrNo then Exit;

   aProcList   := TStringList.Create;
   aAuthorized := TStringList.Create;
   aBlocked    := TStringList.Create;
//
   SSIni := TIniFile.Create(pbPath.MainDir+'servercfg.INI');
   // server

   bDenyLogins          := SSIni.ReadBool('Server','DenyLogins',False);
   iMaxConnections      := SSIni.ReadInteger('Server','MaxConnections',100);
   iConnectionTimeout   := SSIni.ReadInteger('Server','ConnectTimeout',300);

   iDeadSessionInterval := SSIni.ReadInteger('Server','DeadSessionInterval',30);
   iDeadSessionExpires  := SSIni.ReadInteger('Server','DeadSessionExpires',3000);
   iMaxDeadSessions     := SSIni.ReadInteger('Server','MaxDeadSessions',64);

   sTempDirectory       := SSIni.ReadString('Server','TempDirectory','');

   SSIni.ReadSection('Authorized',aAuthorized);
   SSIni.ReadSection('Blocked',aBlocked);

   ServerEngine.ModifyServerConfig(bDenyLogins,iMaxConnections,iConnectionTimeout,
     iDeadSessionInterval,iDeadSessionExpires,iMaxDeadSessions,
     sTempDirectory,aAuthorized,aBlocked);

   // user
   sUserName        := SSIni.ReadString('User','UserName','');
   sPassword        := SSIni.ReadString('User','Password','');
   sUserDescription := SSIni.ReadString('User','Description','');
   bAdmin           := SSIni.ReadBool('User','Admin',False);
   // invoke
   try
     ServerEngine.AddServerUser(sUserName,sPassword,sUserDescription,bAdmin,iMaxConnections);
   except
     ServerEngine.ModifyServerUser(sUserName,sPassword,sUserDescription,bAdmin,iMaxConnections);
   end;

   // database
   sDBName        := SSIni.ReadString('Database','DBName','');
   sDBDescription := SSIni.ReadString('Database','Description','');
   sDBPath        := SSIni.ReadString('Database','Path','');
   // invoke
   try
     ServerEngine.AddServerDatabase(sDBName,sDBDescription,sDBPath);
   except
     ServerEngine.ModifyServerDatabase(sDBName,sDBDescription,sDBPath);
   end;

   // database users
   bDBRights      := SSIni.ReadBool('DataUsers','Rights',True);
   if bDBRights then
     aUserPermissions :=
[drRead,drInsert,drUpdate,drDelete,drCreate,drAlter,drDrop,drRename,drMaintain,drBackup,drRestore]
   else aUserPermissions := [];
   // invoke
   try
     ServerEngine.AddServerDatabaseUser(sDBName,sUserName,aUserPermissions);
   except
     ServerEngine.ModifyServerDatabaseUser(sDBName,sUserName,aUserPermissions);
   end;

   // procedures
   SSIni.ReadSection('Procedures',aProcList);
   // invoke
   aProcRights := [prExecute];
   for i := 0 to aProcList.Count-1 do begin
     try
       ServerEngine.AddServerProcedure(aProcList[i],''{description});
     except
       ServerEngine.ModifyServerProcedure(aProcList[i],''{description});
     end;
     try
       ServerEngine.AddServerProcedureUser(aProcList[i],sUserName,aProcRights);
     except
       ServerEngine.ModifyServerProcedureUser(aProcList[i],sUserName,aProcRights);
     end;
   end;

   // events

   FillChar(aTempDays,SizeOf(aTempDays),#0);
   FillChar(aTempMonths,SizeOf(aTempMonths),#0);

   sStarting := '1/1/2000';
   sEnding   := '1/1/2100';

   sEventName     := SSIni.ReadString('Events','EventName','DailyBackup');
   sEDescription  := SSIni.ReadString('Events','Description','Daily Backup');
   iERunType      := SSIni.ReadInteger('Events','RunType',2);  // daily
   sEStarting     := SSIni.ReadString('Events','Starting',sStarting);
   sEEnding       := SSIni.ReadString('Events','Ending',sEnding);
   sEFrom         := SSIni.ReadString('Events','From','3:00:00 AM');
   sEUntil        := SSIni.ReadString('Events','Until','3:30:00 AM');
   iEEvery        := SSIni.ReadInteger('Events','Every',1);

{$IFDEF CODESITE}
 CodeSite.SendMsgEx(csmNote,'EventName: '+sEventName);
 CodeSite.SendMsgEx(csmNote,'Description: '+sEDescription);
 CodeSite.SendMsgEx(csmNote,'RunType: '+IntToStr(iERunType));
 CodeSite.SendMsgEx(csmNote,'Starting: '+sEStarting);
 CodeSite.SendMsgEx(csmNote,'Ending: '+sEEnding);
 CodeSite.SendMsgEx(csmNote,'From: '+sEFrom);
 CodeSite.SendMsgEx(csmNote,'Until: '+sEUntil);
 CodeSite.SendMsgEx(csmNote,'Every: '+IntToStr(iEEvery));
{$ENDIF}

   // invoke
   try
     ServerEngine.AddServerEvent(sEventName,sEDescription,
                                  TEventRunType(iERunType),
                                  StrToDate(sEStarting),StrToDate(sEEnding),
                                  StrToTime(sEFrom),StrToTime(sEUntil),
                                  iEEvery,
                                  aTempDays,TEventDayOfMonth(1),TEventDayOfWeek(1),aTempMonths);
   except
     ServerEngine.ModifyServerEvent(sEventName,sEDescription,
                                  TEventRunType(iERunType),
                                  StrToDate(sEStarting),StrToDate(sEEnding),
                                  StrToTime(sEFrom),StrToTime(sEUntil),
                                  iEEvery,
                                  aTempDays,TEventDayOfMonth(1),TEventDayOfWeek(1),aTempMonths);
   end;
   // done
   aProcList.Free;
   aAuthorized.Free;
   aBlocked.Free;
   //
   SSIni.Free;
   //
   GetServerInformation;
 end
 else MessageDlg('servercfg.ini does not exist', mtError, [mbOK], 0);
end;


Mon, Sep 4 2006 10:10 AMPermanent Link

"John"
Thanks Scott!

Image