Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread sessionname / autosessionname
Wed, Dec 3 2014 6:59 AMPermanent Link

kamran

Hi

I am just trying to understand the difference in usage.
I have a remote database on a lan.
e.g. data on server (c:\mydata) and 3 workstations accessing that data  (c:\myprog)

( I just need to make sure that the data is updated correctly when more than one user is using the same program
from different workstations and accessing the same data tables.)

1. So is it correct that each workstation needs a unique session name before access to the data?
2. Or is it better to set the autosessionname to true ?
3. The word thread is used a lot. Is that the same as meaning a new session ?
4. A simple example of setup and usage would be very helpful
with an idea of what point in the coding they need to be set.

Thanks for the help in advance.

Kamran
Wed, Dec 3 2014 8:38 AMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 12/3/2014 6:59 AM, kamran wrote:
> 1. So is it correct that each workstation needs a unique session name before access to the data?

No - session names can all be the same. Unique session name is required
for multi threaded apps (see below) so within a single EXE on same computer.

> 2. Or is it better to set the autosessionname to true ?

Depending on your design it might be - it takes care of it for you so
for example when using a datamodule with dbisamsession you can just use
it without worrying about name everywhere in your program.

> 3. The word thread is used a lot. Is that the same as meaning a new session ?

No - thread as in a separate thread of execution within an application.
Every delphi application has 1 thread - main thread - where UI/VCL is
and can have more.

You can have as many sessions per thread as you want though in reality
you usually have 1 and maybe go to few (i can't recall actually having
used more than 2 sessions per thread myself).

In case of delphi if you're using TThread you are using additional
threads. However you might be multi-threaded also thru use of components
- for example Indy HTTP server fires an OnCommandGet for incoming
requests and that event is on separate thread. Similarly other
components might do the same so you just have to read the manual to know
the design of the component.

> 4. A simple example of setup and usage would be very helpful
> with an idea of what point in the coding they need to be set.

Setup of autosessionname? Autosessionname you either set to true or
don't and if you don't then you have to come up with your own way of
generating a unique session name (thread id or guid or random or such)
and propagating it thru other components dependent on the session.

Other than that you use the session and other components exactly the
same way you normally do.

See "Starting Sessions" in the manual and for more details on
multi-threading see "Multi-Threaded Applications". This one also has a
good example for threaded use:
http://www.elevatesoft.com/manual?action=viewtopic&id=dbisam4&product=rsdelphiwin32&version=XE7&topic=Multi_Threaded_Applications

Raul
Image