dbTalk Databases Forums  

2 clients on an MS Access DB?

comp.databases.ms-access comp.databases.ms-access


Discuss 2 clients on an MS Access DB? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jodleren
 
Posts: n/a

Default 2 clients on an MS Access DB? - 04-22-2009 , 11:51 AM






Hi all

I once wrote about my problem "Could not update; currently locked"
http://groups.google.com/group/comp....53b984344 234

The problem is, that there is a saver, cashing data, and a summariser
which goes though data for the last half our and put them in another
table.
There are 2 threads doing this, but they cannot work at the same time.
If I save data every 20 ms, then the "Could not update; currently
locked" error occurs.
AFAIK it should be possible for multiple users to access one *.mdb
file - or am I wrong?

I attach some code here, it that helps.

CoInitialize(nil);
FConnection := CreateOleObject('ADODB.Connection') as _Connection;
FConnection.CursorLocation := adUseServer; { Client if you need to
use recordcount!!!! }
FConnection.Open('Data Source=' + FDatabaseName, FUsername,
FPassword, 0);
FRecordset := CreateOleObject('ADODB.Recordset') as _RecordSet;

var
FRecordset.Open(sSQL, FConnection, adOpenForwardOnly,
adLockReadOnly, adCmdText);
and...
FConnection.Execute(sSQL, aI, 0);
// this fails sometimes, if the threads by accident works at the same
time, even that they are working on different tables.

WBR
Sonnich



Reply With Quote
  #2  
Old   
Tom van Stiphout
 
Posts: n/a

Default Re: 2 clients on an MS Access DB? - 04-23-2009 , 08:41 AM






On Wed, 22 Apr 2009 09:51:24 -0700 (PDT), jodleren <sonnich (AT) hot (DOT) ee>
wrote:

You don't give a lot of information, but to me it seems running some
query every 20 ms (that's milliseconds) is insane. Copying the data to
another table is a violation of relational database design principles.
You may want to re-think your application and database design first.

-Tom.
Microsoft Access MVP


Quote:
Hi all

I once wrote about my problem "Could not update; currently locked"
http://groups.google.com/group/comp....53b984344 234

The problem is, that there is a saver, cashing data, and a summariser
which goes though data for the last half our and put them in another
table.
There are 2 threads doing this, but they cannot work at the same time.
If I save data every 20 ms, then the "Could not update; currently
locked" error occurs.
AFAIK it should be possible for multiple users to access one *.mdb
file - or am I wrong?

I attach some code here, it that helps.

CoInitialize(nil);
FConnection := CreateOleObject('ADODB.Connection') as _Connection;
FConnection.CursorLocation := adUseServer; { Client if you need to
use recordcount!!!! }
FConnection.Open('Data Source=' + FDatabaseName, FUsername,
FPassword, 0);
FRecordset := CreateOleObject('ADODB.Recordset') as _RecordSet;

var
FRecordset.Open(sSQL, FConnection, adOpenForwardOnly,
adLockReadOnly, adCmdText);
and...
FConnection.Execute(sSQL, aI, 0);
// this fails sometimes, if the threads by accident works at the same
time, even that they are working on different tables.

WBR
Sonnich


Reply With Quote
  #3  
Old   
jodleren
 
Posts: n/a

Default Re: 2 clients on an MS Access DB? - 04-23-2009 , 10:04 AM



Hello

This is an existing system, I cannot rethink the system. Most cases
here are not new designs, but existing systems.... which we cannot
really change...

It works this way:

The programme (component) gets data from somewhere, and passes it on
to a thread - and I really do not know how often data come.
The saver caches data in an array in a saver thread, and the thread
then flushes data when present. Data are flushed to a table named
"states"

Next, the summariser thread goes into action every half our, and
summarised data (if present) for that half hour (or more). The thread
reads from states, data from the last record in states_summarised
until the end. These date are them added up etc and saved into
states_summarised.
Then, it finally deletes data from states, upto the time before this
summarisind - the idea is to know at all times, what state we had
before.

So, what I have:

saver: insert into states values(....)

summariser: select * from states where record_time > .....
insert into states_summarised values(....)
delete from states where record_time < .....

WBR
Sonnich


On Apr 23, 4:41*pm, Tom van Stiphout <tom7744.no.s... (AT) cox (DOT) net> wrote:
Quote:
On Wed, 22 Apr 2009 09:51:24 -0700 (PDT), jodleren <sonn... (AT) hot (DOT) ee
wrote:

You don't give a lot of information, but to me it seems running some
query every 20 ms (that's milliseconds) is insane. Copying the data to
another table is a violation of relational database design principles.
You may want to re-think your application and database design first.

-Tom.
Microsoft Access MVP

Hi all

I once wrote about my problem "Could not update; currently locked"
http://groups.google.com/group/comp..../browse_thread...

The problem is, that there is a saver, cashing data, and a summariser
which goes though data for the last half our and put them in another
table.
There are 2 threads doing this, but they cannot work at the same time.
If I save data every 20 ms, then the "Could not update; currently
locked" error occurs.
AFAIK it should be possible for multiple users to access one *.mdb
file - or am I wrong?

I attach some code here, it that helps.

*CoInitialize(nil);
*FConnection := CreateOleObject('ADODB.Connection') as _Connection;
*FConnection.CursorLocation := adUseServer; { Client if you need to
use recordcount!!!! }
*FConnection.Open('Data Source=' + FDatabaseName, FUsername,
FPassword, 0);
*FRecordset := CreateOleObject('ADODB.Recordset') as _RecordSet;

var
*FRecordset.Open(sSQL, FConnection, adOpenForwardOnly,
adLockReadOnly, adCmdText);
and...
*FConnection.Execute(sSQL, aI, 0);
// this fails sometimes, if the threads by accident works at the same
time, even that they are working on different tables.

WBR
Sonnich


Reply With Quote
  #4  
Old   
lyle fairfield
 
Posts: n/a

Default Re: 2 clients on an MS Access DB? - 04-23-2009 , 10:08 AM



Is it a big secret as to what application you might be using? Maybe
Pythia could tell us?

On Apr 22, 12:51*pm, jodleren <sonn... (AT) hot (DOT) ee> wrote:
Quote:
Hi all

I once wrote about my problem "Could not update; currently locked"http://groups.google.com/group/comp.databases.ms-access/browse_thread...

The problem is, that there is a saver, cashing data, and a summariser
which goes though data for the last half our and put them in another
table.
There are 2 threads doing this, but they cannot work at the same time.
If I save data every 20 ms, then the "Could not update; currently
locked" error occurs.
AFAIK it should be possible for multiple users to access one *.mdb
file - or am I wrong?

I attach some code here, it that helps.

* CoInitialize(nil);
* FConnection := CreateOleObject('ADODB.Connection') as _Connection;
* FConnection.CursorLocation := adUseServer; { Client if you need to
use recordcount!!!! }
* FConnection.Open('Data Source=' + FDatabaseName, FUsername,
FPassword, 0);
* FRecordset := CreateOleObject('ADODB.Recordset') as _RecordSet;

var
* FRecordset.Open(sSQL, FConnection, adOpenForwardOnly,
adLockReadOnly, adCmdText);
and...
* FConnection.Execute(sSQL, aI, 0);
// this fails sometimes, if the threads by accident works at the same
time, even that they are working on different tables.

WBR
Sonnich


Reply With Quote
  #5  
Old   
Larry Linson
 
Posts: n/a

Default Re: 2 clients on an MS Access DB? - 04-23-2009 , 08:34 PM



"lyle fairfield" <lyle.fairfield (AT) gmail (DOT) com> wrote

Quote:
Is it a big secret as to what application you
might be using? Maybe Pythia could tell us?
As far as I know, neither Access nor Jet is multi-threaded and I never even
speculated as to how Jet might act/react when used by a multi-threaded
application.

Maybe the poster could go via Delphi to the Oracle for the answer.

Larry Linson
Microsoft Office Access MVP





__________ Information from ESET Smart Security, version of virus signature database 4031 (20090423) __________

The message was checked by ESET Smart Security.

http://www.eset.com






Reply With Quote
  #6  
Old   
CDMAPoster@FortuneJames.com
 
Posts: n/a

Default Re: 2 clients on an MS Access DB? - 04-25-2009 , 11:34 PM



On Apr 23, 11:08 am, lyle fairfield <lyle.fairfield (AT) gmail (DOT) com> wrote:

Quote:
Is it a big secret as to what application you might be using? Maybe
Pythia could tell us?
I think that your oracular reference while seeking divine inspiration
in determining the application in question is not a good analogy for
the following reason. Given the description by, I believe, Herodotus
of how the extremely profitable Oracle at Delphi worked in practice,
the Oracle was actually clued in by the gods in an authentic way that
was truly mystical and marvelous or she had an espionage network that
was second to none. I prefer to suspect the latter. I don't discount
divine revelation as a possibility in determining jodleren's
application. The doubts I have about your analogy are more about the
reach of your spy network :-).

James A. Fortune
CDMAPoster (AT) FortuneJames (DOT) com


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.