Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Urgent Newbie question on ConfigPath
Mon, Jun 23 2014 3:42 PMPermanent Link

Eduardo

Avatar

Hi there,

I am having a hard time with configpath, besides now I understand that each connection needs to point to the same configpath due to the locking mechanism I am trying to understand WHY is it needed;

I dont understand why in the server there is a path already defined on the config settings telling where the config is, and why is that needed on the client to connect. Or could just leave it blank?

It is hard to see something so important for the database sharing works that need to be configured in each client trying to connect. It does not make sense to me. I understand that eventually there are some scenarios where it make sense, but by default it should be something to be under control of the server only, or attached to the database created at the first time and all connection to that database after inherit that, since anything different will cause problems.

So, can I leave it blank? (configpath)

How to use the default defined in the server? (windows 2008 server running edbserver as service)

at server side it is E:\erpdb where the config is, kinda strange to have to store that configuration in each client.
Mon, Jun 23 2014 4:14 PMPermanent Link

Barry

Eduardo wrote:

>
I dont understand why in the server there is a path already defined on the config settings telling where the config is, and why is that needed on the client to connect. Or could just leave it blank?
<

If you are using the EDB Client/Server, then the Delphi client app does NOT use the config path so you can leave it empty. The client uses the IP Address or Host Name to connect to the EDB server. Your client would only need the config path if you were NOT using C/S.

>So, can I leave it blank? (configpath) <

YES

>How to use the default defined in the server? (windows 2008 server running edbserver as service)
>at server side it is E:\erpdb where the config is, kinda strange to have to store that configuration in each client.

You don't need to, as already explained.

Barry
Mon, Jun 23 2014 4:16 PMPermanent Link

Eduardo

Avatar

adding to the questions above:

I am trying to create 2 databases, I use the same structure for each one, in terms on how I connect.

I have a class that holds the ElevateDB components for connection, and I create a new object of this class for each database needed (currently 2).

But I will eventually have threads running and for that I create new instances of this object for safety,

I am posting almost all the methods of this class below, where I have in create the components creation and reading from a ini file.

I have the CreateDatabase that is triggered when the database is non existent and needs to be created and finally a way to check if the database is empty (mean not created or initialized yet)

[code]
constructor TNaharElevateDBConnectionAdapter.Create(ADataBase: string; AConfig: TNaharConfig; AConfigSession: string);
begin
 inherited;

 // engine --------------------
 FEDBEngine                  := TEDBEngine.Create(nil);
 FEDBEngine.LargeFileSupport := true;

 if not FEDBEngine.Active then
   FEDBEngine.ConfigPath     := Config[ConfigSession, 'ConfigPath'];

 FEDBEngine.Active           := true;

 // session ---------------------
 FEDBSession                 := TEDBSession.Create(nil);
 FEDBSession.Name            := 'Session';
 FEDBSession.AutoSessionName := True; //required for threading
 FEDBSession.LoginUser       := 'Administrator';
 FEDBSession.LoginPassword   := 'EDBDefault';

 if AConfig[AConfigSession, 'Server'] then
 begin
   FEDBSession.SessionType := stRemote;
   FEDBSession.RemoteHost := Config[ConfigSession, 'RemoteHost'];
   FEDBSession.RemotePort := Config[ConfigSession, 'RemotePort'];
 end
 else
   FEDBSession.SessionType := stLocal;

 // database ---------------------
 FEDBDatabase                := TEDBDatabase.Create(nil);
 FEDBDatabase.Database       := DatabaseName;
 FEDBDatabase.DatabaseName   := DatabaseName;
 FEDBDatabase.SessionName    := FEDBSession.SessionName;

 FEDBSession.Open;

end;

procedure TNaharElevateDBConnectionAdapter.CreateDatabase;
begin
 inherited;
 if FEDBSession.Execute('select * from databases where name = '+QuotedStr(DatabaseName)) = 0 then
   FEDBSession.Execute('CREATE DATABASE '+(DatabaseName)+' PATH '+QuotedStr(Config[ConfigSession, 'DBPath']));
end;

destructor TNaharElevateDBConnectionAdapter.Destroy;
begin
 FEDBDatabase.Free;
 FEDBEngine.Free;
 FEDBSession.Free;

 inherited;
end;

function TNaharElevateDBConnectionAdapter.IsDatabaseEmpty: Boolean;
begin
 result := true;

 if Assigned(FEDBSession) then
   if FEDBSession.Execute('select * from databases where name = '+QuotedStr(DatabaseName)) > 0 then
     if FEDBDatabase.Execute('select * from information.tables') > 0 then
       result := False;
end;
[/code]

I use the following configuration:

[global]
dbdriver=ElevateDB

[standard]
dbdriver=ElevateDB

[global-ElevateDB]
Server=1
RemoteHost=extranet.gordaoexpress.com.br
RemotePort=12010
ConfigPath=e:\erpdb
DBPath=e:\erpdb\dbglobal

[standard-ElevateDB]
Server=1
RemoteHost=extranet.gordaoexpress.com.br
RemotePort=12010
ConfigPath=e:\erpdb
DBPath=e:\erpdb\dbstandard


The first time I run it, I use the GLOBAL one. where I create my software configuration files. (aroud 10 tables)

The second time I run it I use the DEFAULT, that is where I store application data files (hundreds of tables)


Should I use the same ConfigPath for both databases?
As you can see i have separated directories for each database.

I am having some different problems that I am trying to isolate, since I am using Elevatedb with Aurelius.

But right now I am getting a #300 when I go for the second connection (Standard database) when using the ElevateDB Manager. It only let me open ONE database, does not matter which, and both are showing with the same tables, that is wrong.

I am not understanding
Mon, Jun 23 2014 5:15 PMPermanent Link

Eduardo

Avatar

Thanks Barry,

Somehow the configuration on the server was in a wrong state. I have removed everything started over, and not changed the ConfigPath for C/S case.

Then it is now working. I could open both databases at same time and tables were created correctly.

The #300 is now gone. The other problem I had #1101 I have raised the timeouts for disconnection and will keep those values high for while, until I understand how to manage that.

Thanks

Barry wrote:

Eduardo wrote:

>
I dont understand why in the server there is a path already defined on the config settings telling where the config is, and why is that needed on the client to connect. Or could just leave it blank?
<

If you are using the EDB Client/Server, then the Delphi client app does NOT use the config path so you can leave it empty. The client uses the IP Address or Host Name to connect to the EDB server. Your client would only need the config path if you were NOT using C/S.

>So, can I leave it blank? (configpath) <

YES

>How to use the default defined in the server? (windows 2008 server running edbserver as service)
>at server side it is E:\erpdb where the config is, kinda strange to have to store that configuration in each client.

You don't need to, as already explained.

Barry
Image