Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Anyone using TMS Aurelius with EDB? I have a stupid newbie problem.
Mon, Jul 24 2023 3:33 PMPermanent Link

Adam Brett

Orixa Systems

I have set up a TMS RemoteDB Server program.

In the data module of this program I have EDBDatabase, EDBSession and (for testing) a EDBQuery.

It contains a TMS AureliusConnection with "AdapterName" = ElevateDB and "SQLDialect" = ElevateDB, "AdaptedConnection" = EDBDatabase1 ... other components are on the server data module as per TMS examples.


The EDBQuery CAN be opened with a simple SQL Statement, the session & database are both Connected at design time, so I can clearly see that all the EDB side of things works well.

When I run the Server, and then write a Client when I try to connect to the server, it fails with the message "DatabaseName <my database name> already exists." I think TMS must be doing something funny behind the scenes.

Any ideas how I can fix this?

Mon, Jul 24 2023 3:57 PMPermanent Link

Mike

Hi Adam,

Try to use a different approach to create an unique name for the database. For example:

var
 _Counter_: Integer;

procedure TDataModule1.EDBDatabase1BeforeConnect(Sender: TObject);
var
 DB: TEDBDatabase;
begin
 DB := Sender as TEDBDatabase;
 if DB.DatabaseName = ‘’ then
 begin
   DB.DatabaseName := IntToStr(_Counter_);
   AtomicIncrement(_Counter_);
 end;
end;



initialization
 _Counter_ := 1;


Greetings,

Michael
Mon, Jul 24 2023 4:40 PMPermanent Link

Adam Brett

Orixa Systems

Hi Mike.

Thanks for this, I saw this solution suggested on the TMS website. I have no idea why, but it doesn't work for me.

I used the following:

function TServerContainer.DBName: String;
begin
 INC(iDBName);
 Result := 'DB' + IntToStr(iDBName);
end;

procedure TServerContainer.EDBDatabase1BeforeConnect(Sender: TObject);
begin
 if EDBDatabase1.DatabaseName = '' then
   EDBDatabase1.DatabaseName := DBName;
end;

Which I think does the same thing.

In my Server App the EDB Database and Session are not connected at design-time. So I guess the AureliusConnection is calling "Connect" on them at run-time.

I get the error:

---------------------------
RemoteDB request error:

http://localhost:80/test/config

500

Exception Class: EDatabaseError

Message: Database name 'DB1' already exists.
---------------------------
OK   
---------------------------


I am using EDB 27.1, the current version of Aurelius and Delphi 11.3

I am really confused, as I figured it would be pretty straightforward to set up the basic connection.
Thu, Jul 27 2023 5:59 AMPermanent Link

Mike

Try this instead.

       Database := TEDBDatabase.Create(nil);
       with Database do
       begin
         Database := 'MTS';
         if DatabaseName = '' then
           DatabaseName := IntToStr(NativeInt(Database));
           KeepConnection := True;
       end;
       Database.SessionName := Session.SessionName;
       Database.Connected := True;
Thu, Jul 27 2023 10:01 AMPermanent Link

Adam Brett

Orixa Systems

Thanks Mike. I got it working.

I don't think too many people are using EDB and Aurelius ... but is seems a good solution.

I would be curious to have a chat about how you use it what you do etc., totally understand if you don't have time.

If you are interested, email me at

adam <at sign> orixa.co.uk

Thanks.
Image