record numbers  
Author Message
Mario





PostPosted: 2007-8-30 18:40:00 Top

java-programmer, record numbers Maybe my question is stupid and wrong but I hope that you will understand.
So, image that you need to create web application which will used by many
peoples in one LAN. They processing some documents and every person has the
particular number of documents in particular order (1. person has documents
from 1 to 100, second from 101 to 200 etc), which process with the
particular number (first document -> number 1 in a database). If they all
work in a same time, what is the easiest and the most safety way to manage
that? Adding number manually is the logical solution but if 2 person put the
same number, can they freeze the database or databases are imune on that ?


 
Roedy Green





PostPosted: 2007-8-30 19:07:00 Top

java-programmer >> record numbers On Thu, 30 Aug 2007 12:39:53 +0200, "Mario" <email***@***.com> wrote,
quoted or indirectly quoted someone who said :

>Maybe my question is stupid and wrong but I hope that you will understand.
>So, image that you need to create web application which will used by many
>peoples in one LAN. They processing some documents and every person has the
>particular number of documents in particular order (1. person has documents
>from 1 to 100, second from 101 to 200 etc), which process with the
>particular number (first document -> number 1 in a database). If they all
>work in a same time, what is the easiest and the most safety way to manage
>that? Adding number manually is the logical solution but if 2 person put the
>same number, can they freeze the database or databases are imune on that ?

You would not work that way in real life because guaranteed somebody
will need more than 100 documents. There are basically three ways to
deal with documents.

1. put the documents themselves into the SQL database.

2. put just an index of the documents, and perhaps keywords and/or
text but not formatting in the database, and leave the documents as
indpedent files. The server can serve the documents given an URL.

see http://mindprod.com/jgloss/sql.html

3. Buy a turn-key document management system that likely uses a
proprietary database/indexing scheme.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
RedGrittyBrick





PostPosted: 2007-8-30 21:47:00 Top

java-programmer >> record numbers Mario wrote:
> Maybe my question is stupid and wrong but I hope that you will understand.
> So, image that you need to create web application which will used by many
> peoples in one LAN. They processing some documents and every person has the
> particular number of documents in particular order (1. person has documents
> from 1 to 100, second from 101 to 200 etc), which process with the
> particular number (first document -> number 1 in a database). If they all
> work in a same time, what is the easiest and the most safety way to manage
> that? Adding number manually is the logical solution but if 2 person put the
> same number, can they freeze the database or databases are imune on that ?

Many databases allow you to define a column in a table as being
"serial". These have their value allocated by the DBMS when you insert a
record and are guaranteed to be unique.

Most databases allow you to define that a certain column in a table be
"unique". The database will report an error if a second person tries to
add a record with the column set to a value that has been already used.

As Roedy suggested, it's almost certainly not a good idea to
pre-allocate a fixed range of document numbers to each user. I'd include
the user_ID in the "document" table as (say) "author_ID".
 
 
Lew





PostPosted: 2007-8-30 22:05:00 Top

java-programmer >> record numbers RedGrittyBrick wrote:
> Many databases allow you to define a column in a table as being
> "serial". These have their value allocated by the DBMS when you insert a
> record and are guaranteed to be unique.
>
> Most databases allow you to define that a certain column in a table be
> "unique". The database will report an error if a second person tries to
> add a record with the column set to a value that has been already used.

If a so-called "database" does not support this feature it isn't really a
database. If it doesn't support multi-column keys then it isn't really a
database.

> As Roedy suggested, it's almost certainly not a good idea to
> pre-allocate a fixed range of document numbers to each user. I'd include
> the user_ID in the "document" table as (say) "author_ID".

Then a combination of "author[ID]" and the author's own assigned number or
title is unique, and can be used to key the table.

--
Lew
 
 
Sabine Dinis Blochberger





PostPosted: 2007-8-31 16:16:00 Top

java-programmer >> record numbers Mario wrote:

> Maybe my question is stupid and wrong but I hope that you will understand.
> So, image that you need to create web application which will used by many
> peoples in one LAN. They processing some documents and every person has the
> particular number of documents in particular order (1. person has documents
> from 1 to 100, second from 101 to 200 etc), which process with the
> particular number (first document -> number 1 in a database). If they all
> work in a same time, what is the easiest and the most safety way to manage
> that? Adding number manually is the logical solution but if 2 person put the
> same number, can they freeze the database or databases are imune on that ?
>
>
That sounds to me (almost) like a version control system, where you
check a document out and no-one else can edit it for the time being. Or
maybe you need some sort of group ware, that does the same thing.
--
Sabine Dinis Blochberger

Op3racional
www.op3racional.eu