aspose file tools*
The moose likes JDBC and the fly likes Regarding Database Transction sychronisation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Regarding Database Transction sychronisation" Watch "Regarding Database Transction sychronisation" New topic
Author

Regarding Database Transction sychronisation

Prasad Babu
Ranch Hand

Joined: Jul 17, 2005
Posts: 57
Hi All,
Wish you happy New Year!!!

My scenario is: I have a form to enter master records. The Material Id is the element in that form. The value should be retrieved from the database. Get the latest value from the data base and increment it by 1. The ID should start with 0001.So for the second id it is 0002.
This will be a read only field with the value in it while the form is loaded

My question is here how can we achieve Sychronisation? because one or more users can enter the data. If they are doing simulteneously, they may get same Id. so we have sychronise the process util the user insert the date SUCESSFULLY
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
What database are you using? It should have a safe way to generate surrogate key identifiers. For example Oracle uses sequences.


There is no emoticon for what I am feeling!
Prasad Babu
Ranch Hand

Joined: Jul 17, 2005
Posts: 57
Hi Jeff Albrechtsen ,
I am using MySQL 4
Please solve my problem
Thanks in advance
Prasad
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
I can't *solve* your problem, but I can suggest a few things.
I'm a bit rusty on MySQL, but columns can be AUTO_INCREMENT,
and there is a function called LAST_INSERT_ID() that returns
the last value of an auto increment field. Check your documentation.
[ January 06, 2006: Message edited by: Jeff Albrechtsen ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding Database Transction sychronisation