Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Help with development to live setup
Fri, Dec 5 2014 8:27 AMPermanent Link

kamran

Hi

Looking for a tried and tested way to ensure that application can work from any directory and ip address.
e.g. when moving from development setup to an install setup.

Here is my code that I am trying to make work:

procedure TDataFrm.FormCreate(Sender: TObject);
begin
try
 DataFrm.PCSDataBase.Close;
 DataFrm.DBISAMSession.Active:=False;

 DataFrm.PCSDataBase.Directory:='\\Server\PCS';
 DataFrm.DBISAMSession.SessionName:='S1';
 DataFrm.DBISAMSession.SessionType:=stRemote;
 DataFrm.DBISAMSession.RemoteUser:='Admin';
 DataFrm.DBISAMSession.RemotePassword:='DBAdmin';
 DataFrm.DBISAMSession.RemoteAddress:='192.168.1.21';
 DataFrm.DBISAMSession.RemotePort:=12005;
 DataFrm.DBISAMSession.PrivateDir:='c:\pcs';

 DataFrm.DBISAMSession.Active:=True;
 DataFrm.PCSDataBase.Open;
 showmessage('DataBase Location is set to: '+ DataFrm.PCSDataBase.Directory);

 DataFrm.tbCustomer.Open;
 try
except
    On E:Exception do showmessage('ERROR ' + E.Message);
end;
finally
 showmessage('database location settings changed successfully');
end;

end;


I have a dbisamsession component declared with default settings
I have a dbisamdatabasecomponent with default settings declared

I cannot seem to get it work correctly. it must be some settings on my form perhaps!.
So when I make the changes to say the  DataFrm.PCSDataBase.Directory and
DataFrm.DBISAMSession.RemoteAddress:='192.168.1.21'

I would expect it the application to work with the new settings.
Dbsrvr is already loaded and running waiting to accepting connections on the live computer

Would an ini file solution be better on the server and each workstation?

If so does anyone have an ini file available to share and coding sample and which event in the code it should be called to ensure that I don't get these frustrating setup problems that should be simple.. but are not ? I guess I am not as technical as some people here.

All feedback appreciated.

Thanks

Kamran
Fri, Dec 5 2014 11:44 AMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 12/5/2014 8:27 AM, kamran wrote:
> Looking for a tried and tested way to ensure that application can work from any directory and ip address.

There is no directory involved with remote databases.

>    DataFrm.PCSDataBase.Directory:='\\Server\PCS';

You do not need this for remote databases. DBSRVR hides the actual DB
location and you just have to use RemoteDatabase name (and make sure
database is actually defined on the dbsrvr).

For best security practice you should even be sharing the "\\Server\PCS"
path from server - dbsrvr is only thing that needs access to it and none
of the client should access it direct.


>    DataFrm.DBISAMSession.SessionName:='S1';
>    DataFrm.DBISAMSession.SessionType:=stRemote;
>    DataFrm.DBISAMSession.RemoteUser:='Admin';
>    DataFrm.DBISAMSession.RemotePassword:='DBAdmin';
>    DataFrm.DBISAMSession.RemoteAddress:='192.168.1.21';
>    DataFrm.DBISAMSession.RemotePort:=12005;
>    DataFrm.DBISAMSession.PrivateDir:='c:\pcs';

in general for remote sessions you ONLY need IP + port and remote DB
name (and the port and remote DB you can hardcode for your app).

I personally don't use default session but nothing wrong using it - just
make sure your other components are linked to session and db, etc.

Instead of hard-coding the PrivateDir i'd either use a (sub)folder under
the exe or better yet actual user temp folder (unless you know c:\pcs
actually exists). .


>    showmessage('DataBase Location is set to: '+ DataFrm.PCSDataBase.Directory);

See previous note - use RemoteDatabase name for remote sessions.

> I cannot seem to get it work correctly. it must be some settings on my form perhaps!.

You need to be more specific on what does not work properly?

I'm guessing your dbsrvr does not have a DB configured and you're not
referring to RemoteDatabase properly so your app has no way of getting
to the database.

Raul
Fri, Dec 5 2014 12:00 PMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 12/5/2014 11:44 AM, Raul wrote:
> For best security practice you should even be sharing the "\\Server\PCS"

Meant "should NOT even be ..."

> in general for remote sessions you ONLY need IP + port and remote DB
> name (and the port and remote DB you can hardcode for your app).

Meant you don't need any of the directory business on client side.

One does need user/password also of course.

Raul
Sat, Dec 6 2014 11:51 AMPermanent Link

kamran

Hi Raul

Thanks a lot for pointing me in the right direction.

You are (like so many here) so prompt and helpful.

Regards

Kamran

Raul wrote:

On 12/5/2014 11:44 AM, Raul wrote:
> For best security practice you should even be sharing the "\\Server\PCS"

Meant "should NOT even be ..."

> in general for remote sessions you ONLY need IP + port and remote DB
> name (and the port and remote DB you can hardcode for your app).

Meant you don't need any of the directory business on client side.

One does need user/password also of course.

Raul
Image