Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Multiple databases in ISAPI app
Sun, Apr 5 2009 11:44 AMPermanent Link

Mark
Hello

We have written a specialist application server (aka webserver) that uses EDB to store user logons and some basic text outputs during page hits and it works well.

As part of our development, we have decided to implement ISAPI modules to deliver different applications from the same platform.

Each ISAPI module uses a different database, but when the ISAPI module is loaded into memory, it seems to think that it should use the database engine in the main webserver code.

I am confused because if I want the ISAPI module to open independant data, how am I supposed to use point to the correct data without upsetting the core database engine.

Of course we tried adding a new database engine in the ISAPI datamodule and it moaned quite rightly, and without this we get the 'config file is emtpy' errors when trying to connect
to the ISAPI application's datasets at runtime (although in the IDE it seems to connect correctly)

I think this is a concept error in our thinking as we have moved from DBISAM where, in this instance we would have just pointed to the directory that holds the data.

Any thoughts.  Can someone put me straight?

Mark.
Sun, Apr 5 2009 12:06 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Mark


From what you're saying, and as a non-ISAPI user, you should just be able to do the following:

1. set the engine.UseLocalConfigPath to True
2. set the session to the appropriate config path
3. hook up databases as required

The engine is a singleton but the session you can have lots of so if your app thinks the engine is already there just use sessions and databases.

Roy Lambert [Team Elevate]
Sun, Apr 5 2009 2:05 PMPermanent Link

Mark
Hi Roy

Thanks for your speedy response.

> 1. set the engine.UseLocalConfigPath to True

Couldn't find this property in the EDBEngine, did you mean eng.UseLocalSessionEngineSettings?

> 2. set the session to the appropriate config path
> 3. hook up databases as required


Like this?

 QueryModule:=TDataQueryModule.Create(nil);
 try
    QueryModule.EDBSession1.LocalConfigPath:=FDataPath;
    QueryModule.EDBSession1.Connected:=true;
    QueryModule.EDBQuery2.SQL.Text:='select * from ... etc';
    QueryModule.EDBQuery2.Active:=true;
    QueryModule.EDBQuery2.First;
 finally
    QueryModule.Free;
 end;

When I run this code, when the session.connected is raised to True, I get an error 'the config path is empty' or similar.

The querymodule has an EDBDatabase, EDBQuery and an EDBSession.  The SessionName on each is set to the autogenerated name of the
session component and I can set the session component to connected in the IDE.

I know this shouldn't be difficult!  Where am I going wrong?

Mark.
Mon, Apr 6 2009 3:27 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Mark

>> 1. set the engine.UseLocalConfigPath to True
>
>Couldn't find this property in the EDBEngine, did you mean eng.UseLocalSessionEngineSettings?

Sorry - yes that's the one I meant. I typed from memory and I just can't seem to remember "UseLocalSessionEngineSettings"

>> 2. set the session to the appropriate config path
>> 3. hook up databases as required
>
>
>Like this?
>
> QueryModule:=TDataQueryModule.Create(nil);
> try
> QueryModule.EDBSession1.LocalConfigPath:=FDataPath;
> QueryModule.EDBSession1.Connected:=true;
> QueryModule.EDBQuery2.SQL.Text:='select * from ... etc';
> QueryModule.EDBQuery2.Active:=true;
> QueryModule.EDBQuery2.First;
> finally
> QueryModule.Free;
> end;
>
>When I run this code, when the session.connected is raised to True, I get an error 'the config path is empty' or similar.
>
>The querymodule has an EDBDatabase, EDBQuery and an EDBSession. The SessionName on each is set to the autogenerated name of the
>session component and I can set the session component to connected in the IDE.
>
>I know this shouldn't be difficult! Where am I going wrong?

If you can open it in the IDE you must be doing something right. I have two guesses 1) FDataPath is empty and 2) you have the session set to connected in the IDE so when the datamodule is created its trying to connect the session before you get a chance to provide a path.

Roy Lambert [Team Elevate]
Mon, Apr 6 2009 7:18 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< Each ISAPI module uses a different database, but when the ISAPI module is
loaded into memory, it seems to think that it should use the database engine
in the main webserver code.

I am confused because if I want the ISAPI module to open independant data,
how am I supposed to use point to the correct data without upsetting the
core database engine. >>

If these are WebSnap/WebBroker ISAPI modules, then what you need to do is
this:

In the main .dpr for the ISAPI project, add the Engine.ConfigPath setting
like this:

 Engine.ConfigPath:='c:\myconfigpath';
 Application.Initialize;
 Application.CacheConnections:=False;
 Application.MaxConnections:=0;
 Application.CreateForm(TManualModule, ManualModule);
 Application.Run;

You could also configure any other engine properties that you wish there.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image