Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread ElevateDB Manager and Multi-thread sessions
Tue, Sep 22 2020 8:15 AMPermanent Link

Charalampos Michael

Hello,
 Is ElevateDB manager creating new sessions in non multi-threaded way as i can see ?
 (I did ot found any locks on the source code when it's creating a new TEDBSession)

Thank you
Tue, Sep 22 2020 9:19 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

I'm not sure what you're asking, or why you're asking it. As far as I know EDBManager creating a session is simply writing a bit of bumph to an ini file, creating a TEDBSession and putting the same intomation into it then opening the session. What do you expect to be happening?

Roy Lambert
Tue, Sep 22 2020 9:31 AMPermanent Link

Raul

Team Elevate Team Elevate

On 9/22/2020 8:15 AM, Charalampos Michael wrote:
> Hello,
>    Is ElevateDB manager creating new sessions in non multi-threaded way as i can see ?
>    (I did ot found any locks on the source code when it's creating a new TEDBSession)

Yes - that is expected since everything needs to be run/accessed in main
UI thread (EDB manager is a gui tool).

EDB engine itself handles database/table/row locking automatically so
you don't need to create your own locks just for creating new sessions
in code.

Raul
Tue, Sep 22 2020 1:39 PMPermanent Link

Charalampos Michael

I have an application which it's multi-threaded and i'm accesing the Tables using below guideline:
https://www.elevatesoft.com/manual?action=viewtopic&id=edb2&product=delphi&version=7&topic=multi_threaded_applications

If you search ElevateDB Manager source code you'll see that it doesn't use a lock when it's creating a session.

So if my multi-threaded application is running and i open ElevateDB Manager to open the database to eg, modify some data, after that strange things start to happen.

Thank you
Tue, Sep 22 2020 11:50 PMPermanent Link

Raul

Team Elevate Team Elevate

On 9/22/2020 1:39 PM, Charalampos Michael wrote:
> I have an application which it's multi-threaded and i'm accesing the Tables using below guideline:
> https://www.elevatesoft.com/manual?action=viewtopic&id=edb2&product=delphi&version=7&topic=multi_threaded_applications

That is correct and essentially boils down to ensuring you have unique
session (with unique name) for each thread and then all other components
(database, table query etc) must be unique as well and use that same
session (and database in case of table and query etc).

It just ensures that separate threads do not share any edb objects which
can lead to all kinds of problems.

This specifically refers to "other" thread in your application - your
app main thread can do same or use the default session/database provided
by edb.

> If you search ElevateDB Manager source code you'll see that it doesn't use a lock when it's creating a session.

What makes you think it should create a lock and what kind of lock ?

EDB Manager is just another Delphi application - like your app - and
same rules apply to it. There is nothing "special" about EDB Manager in
terms of how it accesses EDB.

Note that actual EDB engine gets compiled into the each application that
handles all of this and EDB Manager and your app are 100% independent
and have their own EDB engines.

>
> So if my multi-threaded application is running and i open ElevateDB Manager to open the database to eg, modify some data, after that strange things start to happen.
>

Can you expand on what strange behavior you are seeing - what is taking
place ?

First I would double-check that your app and EBD manager are actually
using the exact same configuration file. Something as simple as using a
copy of config in one vs another can cause all kinds of evil.

Can you also confirm what version of EBD are your running ?

Finally my suspicion is that issue is with your app as there are number
of others no doubt using multi threaded apps also.

I would do another check  in code - look for table/query dropped on
datamodule and used in a thread or created in code in thread and not
attached to local session and database.

If there are code snippets you'd want to post i'm sure many here would
be happy to take a look and same goes for questions.

Hope you get to the bottom of this

Raul
Wed, Sep 23 2020 3:26 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Charalampos

I pretty much agree with Raul


If both your application and EDBManager are using the same config file then things should just work (always have for me). I you're using a different config file pointing at the same data you shouldn't be able to access the data from whichever program starts second.

My approach to sessions is that they don't do much in the way of accessing the  data but act as a gatekeeper allowing specific things through eg you can run a query over two or more databases but not between two or more sessions.


Roy Lambert
Wed, Sep 23 2020 4:13 PMPermanent Link

Charalampos Michael

Hello,
 I'm using the latest version (as now) of EDB.
 
 Since you tell me that there isn't any issue for EDB Manager to access the same config and table(s) with my multi-thread application so i guess the problem is on my application.
 
  I'll dig out more and keep you informed.
 
Thank you all for the replies guys!
Image