Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Multi Thread Database App.

Posted on 1999-06-28
11
Medium Priority
?
271 Views
Last Modified: 2010-04-06
Hello Experts :)

I'try to make MultiThread Database Application, in main Thread i have 1 Session, 1 Database component and in 2nd Thread too, with different name.

the portion of my code :

               Session1.NetFileDir := MyAliasPath;
               Session1.PrivateDir := MyAppDir;

               Database1.SessionName := Session1.SessionName;
               Database1.AliasName := MyAlias;

               Session2.NetFileDir := MyAliasPath;
               Session2.PrivateDir := MyAppDir;

               Database2.AliasName := AliasZahir;
               Database2.SessionName := Session2.SessionName;

But when i try to activate both session an error arise 'Directory is Busy'

I set BDE Admin LocalShare True and False and nothing happend

I use paradox, delphi 3, and BDE 5.01

Please help, any comment about Multi Thread Database App. are welcome :)


Regards
Adeng.
0
Comment
Question by:adeng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 1384955
The 2 sessions are the problem. Just use one session for both threads or use different directries.

Regards,

Epsylon.
0
 
LVL 1

Author Comment

by:adeng
ID: 1384956
Thanks Epsylon

I've tried to use 1 session (and still 2 TDatabase) and when both threads is reading from same table my app lockup (hang)

Regards
Adeng.

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1384957
hi adeng,

use different privatedirs for each session, thats all (i hope)

meikl ;-)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 13

Expert Comment

by:Epsylon
ID: 1384958
Hey Meikl, what are you doing...??????????
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1384959
hi eps,

this errormessages > 'Directory is Busy'
identifies that a privatedir is in use by another session
the netfiledir can be the same (should be the same)

i just point it out, well i've just not tested, therefore i can be wrong
don't worry, but as i posted this answer, i have not really seen your comment

meikl ;-)

0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1384960
I don't think the two sessions are the problem (rather the solution he wants - read the TSession help, it explains it fairly well, you should also read the help on 'Managing multiple sessions' and 'Working with a session component').

If you want to run multithreaded DB apps you need to use multiple sessions as these are thread safe.

You can also use the Sessions global to manage multiple sessions dynamically if you like.

You could try not setting private dir and let Delphi assign it automatically.

Cheers,

Raymond.



0
 
LVL 1

Author Comment

by:adeng
ID: 1384961
Hi Meikl, long time no see

Sorry to reject your answer, there's an error message 'Directory is controlled by other NET file.

My application is work well on lan (peer-to-peer), there's no problem if two or more user open the same data at the same time.

And thanks to Raymonds for your comments, i am reading TSession help right now.

Regards.
Adeng.
0
 
LVL 1

Author Comment

by:adeng
ID: 1384962
Meikl, please forgive me :) i made a mistake
your answer is 100% true, (you mean PrivatDir, but i change NetFileDir)

Send your comment again

Thanks
Adeng.
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 400 total points
ID: 1384963
hi adeng,

nice to hear from you, how are you?

yup, i meant the privatedir.
had a similar problem a few month ago,
therefore i hoped that my solution
for this works also for you (as it does).

glad that you can go on

good luck again

meikl
0
 
LVL 1

Author Comment

by:adeng
ID: 1384964
I'm fine and still working on my code, thanks for your help.

Adeng.
0
 
LVL 1

Expert Comment

by:Asw
ID: 1384965
Hi adeng,

I have just had the same problem.

I have left a message Titled Help with paradox on a Network.

Check it out.

ASW

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question