Accessing an databases in concurrent threads
jda
jda at his.com
Sun Mar 20 13:24:37 CST 2005
> > The problem I'm having is that if a database is in use and another
>> request comes in, I have to get acces to that database to do a query
>> (again, read only, so no locked cursor problems). However, if I try
>> to open a databas that is in use of course an exception is generated.
>> I wonder what the best solution is?
>>
>> I have thought of:
>>
>> 1. polling any open socket threads and setting "myDatabase" of the
>> new thread to the "myDatabase" of a thread using the same folderItem
>>
>> 2. using a try/catch block when trying to open the database, and if
>> it's a "file is open" error trying again (for,say, 60 seconds) until
>> I either open the database or it times out.
>>
>> Any thoughts/suggestions?
>
>Each thread should keep own cursor.
>
>You need one semaphore for Valentina
>
>Each thread must concurrent for this semaphore/mutex
>
Each thread does this already.
The problem isn't keeping the threads separate. The problem is that
if one thread tries to open a database in use by another, there is an
exception.
Jon
More information about the Valentina-beta
mailing list