How to share Database ? 
Author Message
 How to share Database ?

Ia hava a delphi 3 application running in a network. They both use the
same database. It works fine locally, but recently I wanted to move it
in a networked environment, where I didn't have any experience. The
problem is simple to describe, and maybe It has been treated many
other times.
I use an Access Database, and When I insert a new record in a Table, I
must generate a progressive number. I use a table for this, for I
found problems using autoincrementing numbers in Access Tables when
used in a Delphi Application. I open this Table, count its elements,
add one unit to this value, and use this calculated value as key value
in the main table. So the numbers I generate will be unique, and
progressive.
Well, now, sharing the database, if two users access the same table,
both generate the same key value. I tried to lock the table, but it
seems not working. What is the correct approach to this problem ?
Where could I find more info about this problem ? I mean, developing
application that manage shared database. All the Delphi books I have
read describe only desktop database.

Thanks in advance

Francesco



Wed, 18 Jun 1902 08:00:00 GMT  
 How to share Database ?
IMO, the only absolutely safe way to do this is to maintain a counter in a
different table that contains a single record.  You may have multiple
counter fields if required.  This record is never locked for any longer than
it takes to grab the current value, increment it, and store it back.

Also, make sure that the Local Share setting in the BDE is set to True,
although I don't know if this applies to Access or not.

Finally, Access has always been considered a relatively fragile database.
You may want to reconsider your choice if you expect to have more than a few
users and a lot of records.

Paul / ColumbuSoft
www.columbusoft.com



Quote:
> Ia hava a Delphi 3 application running in a network. They both use the
> same database. It works fine locally, but recently I wanted to move it
> in a networked environment, where I didn't have any experience. The
> problem is simple to describe, and maybe It has been treated many
> other times.
> I use an Access Database, and When I insert a new record in a Table, I
> must generate a progressive number. I use a table for this, for I
> found problems using autoincrementing numbers in Access Tables when
> used in a Delphi Application. I open this Table, count its elements,
> add one unit to this value, and use this calculated value as key value
> in the main table. So the numbers I generate will be unique, and
> progressive.
> Well, now, sharing the database, if two users access the same table,
> both generate the same key value. I tried to lock the table, but it
> seems not working. What is the correct approach to this problem ?
> Where could I find more info about this problem ? I mean, developing
> application that manage shared database. All the Delphi books I have
> read describe only desktop database.

> Thanks in advance

> Francesco



Wed, 18 Jun 1902 08:00:00 GMT  
 How to share Database ?
What  format do you suggest to use instead of Access mdb-files?

Quote:
>Finally, Access has always been considered a relatively fragile database.
>You may want to reconsider your choice if you expect to have more than a
few
>users and a lot of records.



Wed, 18 Jun 1902 08:00:00 GMT  
 How to share Database ?
dBase tables are native to Delphi and can handle millions of rows and 50+
users.

Paul / ColumbuSoft
www.columbusoft.com


Quote:
> What  format do you suggest to use instead of Access mdb-files?

> >Finally, Access has always been considered a relatively fragile database.
> >You may want to reconsider your choice if you expect to have more than a
> few
> >users and a lot of records.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. HELP: sharing database connection (like Delphi and Database Explorer)

2. File-Share Databases

3. Problem sharing databases

4. Updating shared database

5. Q: Shared database connect between DLL's

6. TechTips: Dealing with corruption in shared databases

7. Updating shared database

8. FollowUp: On Shared Database Files, ScanDisk, and FILEnnnn.CHK files

9. Delphi & Clipper Shared Databases?

10. Q: to SHARE or not to SHARE ?

11. Problem Sharing PARADOX tables via shared directory on server

12. Shared databases table (Paradox)

 

 
Powered by phpBB® Forum Software