Board index » delphi » Database application for multi-users

Database application for multi-users

Hi Folks,

I am writing an application that will be running in several computers at
the same time accessing an DBF database in our server. I am using BDE and
what I want is to lock a record when my application is using it, so that
another application won't be able to change the record while I am working
on it (something like the ReadOnly property but just for the record I am
working with)... Is it the default in BDE applications??? If not, who can I
do it??? I thought of adding a field to control this, i.e., when I start
working with the record I set this field to some value, so that other users
can't change it, but it would be very hard to have all these controls,
isn't there an easier way to do it???

                                            []s Rafael Guimaraes

 

Re:Database application for multi-users


If you are using TTable components to access these tables try
the "locktable" (and "unlocktable") method.

--Tony

Quote
Rafael Guimaraes wrote:

> Hi Folks,

> I am writing an application that will be running in several computers at
> the same time accessing an DBF database in our server. I am using BDE and
> what I want is to lock a record when my application is using it, so that
> another application won't be able to change the record while I am working
> on it (something like the ReadOnly property but just for the record I am
> working with)... Is it the default in BDE applications??? If not, who can I
> do it??? I thought of adding a field to control this, i.e., when I start
> working with the record I set this field to some value, so that other users
> can't change it, but it would be very hard to have all these controls,
> isn't there an easier way to do it???

>                                             []s Rafael Guimaraes

Re:Database application for multi-users


I could be wrong about this, but I believe that DBF(dbase?) tables
aren't "server-oriented" and therefor provide very little support for
multi-user access. I think I remember seeing something about the BDE
locking the ENTIRE table while a user is working on it.. Anybody??

Dave

Quote
Rafael Guimaraes wrote:

> Hi Folks,

> I am writing an application that will be running in several computers at
> the same time accessing an DBF database in our server. I am using BDE and
> what I want is to lock a record when my application is using it, so that
> another application won't be able to change the record while I am working
> on it (something like the ReadOnly property but just for the record I am
> working with)... Is it the default in BDE applications??? If not, who can I
> do it??? I thought of adding a field to control this, i.e., when I start
> working with the record I set this field to some value, so that other users
> can't change it, but it would be very hard to have all these controls,
> isn't there an easier way to do it???

>                                             []s Rafael Guimaraes

--

Angels & Algorithms - http://www.keil.com/~davidl

Re:Database application for multi-users


On Fri, 29 Aug 1997 10:51:15 -0500, David Lively

Quote
<dav...@spam.keil.com> wrote:
>I could be wrong about this, but I believe that DBF(dbase?) tables
>aren't "server-oriented" and therefor provide very little support for
>multi-user access. I think I remember seeing something about the BDE
>locking the ENTIRE table while a user is working on it.. Anybody??

The BDE implements record locking automatically for Paradox (.DB) and
dBase (.DBF) tables.

The only time a table would be locked is if you opened it with
Exclusive set to true.

The record is locked when you do a Table.Edit, and unlocked when you
post or cancel the changes.

MS Access (at least older versions) locks BLOCKS of records, which I
found to be a real mess.

Chuck Gadd
Director of Software Development, {*word*104} FX Communications.
e-mail:cgadd-NOS...@{*word*104}-fx.com  http://www.csd.net/~cgadd
Remove the -NOSPAM from my email address to send me e-mail.
*** I boycott businesses that send me unsolicited email adverti{*word*224}ts ***

Re:Database application for multi-users


On 27 Aug 1997 22:26:47 GMT, "Rafael Guimaraes"

Quote
<rgu...@redegazeta.com.br> wrote:
>what I want is to lock a record when my application is using it, so that
>another application won't be able to change the record while I am working

When you start to edit the record, it will be locked by the BDE.
Note:  If you are using a peer to peer network, you need to set
LocalShare to True in the BDE Config.  

The record will be automatically unlocked when the update is posted
(Table.Post, or moving to the next record which will automatically
post the record for you! ) or when the update is Cancelled
(Table1.Cancel).

If you are editing the first record, I would still be able to look at
the record, but if I tried to edit, it would raise an exception  (I've
got code to catch the error, with a built in retry logic for D2/D3 if
you are interested).

Chuck Gadd
Director of Software Development, {*word*104} FX Communications.
e-mail:cgadd-NOS...@{*word*104}-fx.com  http://www.csd.net/~cgadd
Remove the -NOSPAM from my email address to send me e-mail.
*** I boycott businesses that send me unsolicited email adverti{*word*224}ts ***

Re:Database application for multi-users


_________________________________________

We've used Paradox tables with the BDE in a multi-user network setting
successfully for some time. The key is to use just ONE BDE for the entire
network. This requires a little messing about (but not really very much).
Without doing this (ie, running it with one set of data but a database
engine on every workstation) was totally disastrous, as the BDE can only
lock records and allow access to the rest of the table simultaneously if it
has exclusive access.

What's needed is for the server (or workstation holding the data in a
peer-peer) only to have the BDE installed, and some name-specific drive
mapping so the server BDE drive is uniformly accessed by the entire network
including the server. I'll attach a layman's outline I prepared for the
management of one of the companies where we've done this.

Regards ...
_________________________________________

  ?  Leigh Harrison      
  ?  tel +64 6 343 2671
  ?  fax +64 6 343 2649
  ?  email le...@radiOshop.co.nz
  ?  3 Iris Place Wanganui New Zealand
_________________________________________
                             radiOshop

Rudi Ziegaus <"Rudi.Ziegaus[No Spam please]"@bingo.baynet.de> wrote in
article <34091175....@bingo.baynet.de>...

Quote
> Michael S. Simpson wrote:
> > Client/Server isn't really my cup-o-tea, but I have a question ... If
> > one person is viewing the data while another is editing it, then when
> > the person who is editing the data is done, does the person who is
> > viewing the data get an updated image?

> > Just curious.

> > Mike

> Hi Mike,

> AFAIK this is not the case (at least not by default). However, an
> application could place a hook in the BDE and look for changes and
> could  thus implement the described feature.

> Rudi Ziegaus

begin 600 Running the BDE across a network.txt
<encoded_portion_removed>
end

Re:Database application for multi-users


Quote
>Client/Server isn't really my cup-o-tea, but I have a question ... If
>one person is viewing the data while another is editing it, then when
>the person who is editing the data is done, does the person who is
>viewing the data get an updated image?

>Just curious.

>Mike

The person viewing the data will not automatically see the updated change,
since they are really looking at a copy of the data. If you are using TTable,
then the application must call the Refresh method for that table. If you are
using a TQuery, the application must close the query and open it to see the
updated image.

Fred

=======================================================
Fred Bubbers            http://www.northeast.net/~fredb                  
Sound Beach, NY                     fr...@northeast.net
=======================================================

Re:Database application for multi-users


Quote
Rafael Guimaraes wrote:

> Hi Folks,

> I am writing an application that will be running in several computers at
> the same time accessing an DBF database in our server. I am using BDE and
> what I want is to lock a record when my application is using it, so that
> another application won't be able to change the record while I am working
> on it (something like the ReadOnly property but just for the record I am
> working with)... Is it the default in BDE applications??? If not, who can I
> do it??? I thought of adding a field to control this, i.e., when I start
> working with the record I set this field to some value, so that other users
> can't change it, but it would be very hard to have all these controls,
> isn't there an easier way to do it???

>                                             []s Rafael Guimaraes

When you enter the edit state of a record it is automatically locked
until you post or cancel.
HTH..

Re:Database application for multi-users


Quote
Michael S. Simpson wrote:

> Client/Server isn't really my cup-o-tea, but I have a question ... If
> one person is viewing the data while another is editing it, then when
> the person who is editing the data is done, does the person who is
> viewing the data get an updated image?

> Just curious.

> Mike

Something like the coedit feature in Paradox (DOS)? This is magic you
have to code for yourself, I fear.

--
Achim Richter
office: arich...@hzd.hessen.de
athome: arich...@t-online.de

Re:Database application for multi-users


Quote
TL Stephan <tstep...@nanaimo.ark.com> wrote:
>When you enter the edit state of a record it is automatically locked
>until you post or cancel.
>HTH..

Doesn't this depend on the transaction isolation level?

MH.

***********************************************
Martin Harvey
By popular request, email addresses are now in plain text.
Uni email: mc...@hermes.cam.ac.uk
Home email: mc...@harvey27.demon.co.uk
Uni web pages: http://www-stu.pem.cam.ac.uk/~mch24/
***********************************************

Re:Database application for multi-users


BTW, the component I mentioned before doesn't require any mods to the
WIN.INI.

This is a carry over from Delphi 1.0 which has a ton of them.

Delphi 2 and 3 don't require any mods to the WIN.INI

Delphi 3 added some additional language drivers FAREAST and JAPAN but
other than that, it may contain bug fixes but it runs seamless
otherwise with old code.

Re:Database application for multi-users


I've written a nice little component that handles all the BDE junk
needed for C/S applications to be set-up.  Here is the low-down:

If you have your application thus:

H:\MyApp
  |__BDE

MYAPP.EXE is in H:\MyApp

From the client PC, you run H:\MyApp\MYAPP.EXE

The component I wrote automatically assumes that the BDE is in a
folder named BDE under the application's home folder.  When MYAPP.EXE
is run on the Client, from the server folder, it automatically updates
the registry on the client, making all the necessary BDE entries, and,
updates the IDAPI32.CFG file on the server.

It also fixes a *BUG* in the TSession which does not update the NETDIR
entry in the registry (To prove this, check the NetDir setting in the
registry.  Change TSession.NetDir in code to something else, then use
TSession.SaveConfigFile.  Check the registry again, it won't be
changed.)

Not updating the NetDir really screws up things as you'll then have
multiple PDXUSERS.NET files across your network!

Anyway, anyone who wants it, let me know!

Re:Database application for multi-users


I might be wrong on this, but as far as I know your data is not updated
unless you refresh it by calling the Refresh method.
--
John Bester
jbes...@ilink.nis.za

Quote
> Client/Server isn't really my cup-o-tea, but I have a question ... If
> one person is viewing the data while another is editing it, then when
> the person who is editing the data is done, does the person who is
> viewing the data get an updated image?

> Just curious.

> Mike

Re:Database application for multi-users


 >When you enter the edit state of a record it is automatically locked

Quote
>until you post or cancel.
>HTH..

I beg to differ, this is very dependant on the server you're using.
I'm currently programming for SQL Server using D3, and there
is no record locking as such. What happens is that when a user
tries to post a change, Delphi first checks to see if the record
has been changed on the serverside since the edit began.
If it has, someoneelse has allready posted a change, and
Delphi raises an exception saying "can't post changes, because
another user allready changed the record", or some such.

I'd love to have record locking though....

Mattias

Re:Database application for multi-users


Rafael Guimaraes <rgu...@redegazeta.com.br> wrote in article
<01bcb338$79d56560$5b0ef...@pc3-vix.vix.nutecnet.com.br>...

Quote
> Hi Folks,

> I am writing an application that will be running in several computers at
> the same time accessing an DBF database in our server. I am using BDE and
> what I want is to lock a record when my application is using it, so that
> another application won't be able to change the record while I am working
> on it (something like the ReadOnly property but just for the record I am
> working with)... Is it the default in BDE applications??? If not, who can
I
> do it??? I thought of adding a field to control this, i.e., when I start
> working with the record I set this field to some value, so that other
users
> can't change it, but it would be very hard to have all these controls,
> isn't there an easier way to do it???

>                                             []s Rafael Guimaraes

Depende que tipo de arquitectura voc pretende em rede. Mas supondo ser uma
base de dados distribuda(client server(?)) voil algumas dicas:

1. As tabelas dever?o ser pblicas. De preferncia no file server;
2. O BDE deve ser instalado e configurado convenientemente em cada esta??o
de trabalho;
3. Dever activar o SHARE LOCAL no BDE.

N?o preciso bloquear nada.

Pessoalmente prefiro trabalhar com tabelas Paradox 5.0.

Go to page: [1] [2]

Other Threads