This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
1) A file will be created and will be feeded as input to another system which will read the data's and will insert into DB . My requirement is when ever i create the file i should have three fields(lets say field1,field2,field3) with unique number .
a) field1 can have 5 digits
b) field2 can have 13 digits .
c) feild3 can have 10 digits .
All 3 fields should be numeric . There will be 10 users . These fields should be unique when ever they generate the file. Any solution is higly appreciated ..
As I understand the requirement. there are 10 users, and all of them can generate a file for themselves containing 3 numbers. And these numbers should be unique to a file i.e. they should not be in a file generated by some other user. And I am assuming that the numbers in the file must be unique w.r.t. database too in which they will finally be inserted.
Since this is a multi-user system, I guess you need to maintain a unique number generator which is thread safe(since multiple users can invoke it at the same time). This unique number generator could either use a permanent storage(like database table) to fetch a unique number or could fetch it 'in-memory' by maintainig counters or something similar. The key thing would be to maintain the thread safety of the unique number generator.
Use a sequence number : For Oracle Oracle :www.cs.rpi.edu/~sibel/dbs/FALL2003/system_info/oracle/unique.htm DB2 :www.ibm.com/developerworks/db2/library/techarticle/0205pilaka/0205pilaka2.html MySql ://forums.mysql.com/read.php?61,143867,143867.
NEVER EVER attempt to implement your own sequence numbers in any data base - performance will be degraded by a task locking the sequence number while other tasks wait for the lock to be released.