aspose file tools*
The moose likes JDBC and the fly likes Concurrent updates/deletes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Concurrent updates/deletes" Watch "Concurrent updates/deletes" New topic
Author

Concurrent updates/deletes

forums UseR
Ranch Hand

Joined: Feb 24, 2009
Posts: 169
Hello there,

I have developed a JDBC frontend UI to MS SQL backend. I am not using any synchronized code anywhere. I am now concerned about multiple session trying to deal with same rows. I am not even using "Transaction code" (to be honest, I have no idea how to do transaction coding using JDBC).

Any thoughts/ideas/solutions are appreciated.

Thanks

Srinivas
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

Srinivas,
You are going to have to elaborate to get a useful answer. What are the users doing? What is the scnario you are tyring to prevent?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
forums UseR
Ranch Hand

Joined: Feb 24, 2009
Posts: 169
Jeanne Boyarsky wrote:Srinivas,
You are going to have to elaborate to get a useful answer. What are the users doing? What is the scnario you are tyring to prevent?


Hi Jeanne,

Thanks for your response...

I have developed a Course Registrations web application.

Users:
1. Users can check course schedules on the home screen.
2. They can either register for a course/un-register for a course.

Admins:
1. Admins can create/change/delete courses
2. Create/change/delete course schedules.

Now there are various activities that can occur concurrently...

1. what if the user is trying to register and at the same time, the admin has just finished changing the course schedule!!!

The user still thinks that he's registered for old course schedule..., unless he notices the new schedule and then un-register for the new schedule (if that day/time does not work for him).

2. Two admins are trying to edit the course/course schedule at the same time ? That is, working on the same back end table row..., I haven't used any technique to address these scenarios. I am using just pain old JDBC.

Any thoughts/ideas/solutions are appreciated...
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

Transaction code would help you with the 2 admins at the same time. For the student/admin, it sounds like they would be operating on different data and you would need to write something yourself to handle it.
forums UseR
Ranch Hand

Joined: Feb 24, 2009
Posts: 169
Jeanne Boyarsky wrote:Transaction code would help you with the 2 admins at the same time. For the student/admin, it sounds like they would be operating on different data and you would need to write something yourself to handle it.


I am noob to Transaction code in JDBC. Can you please give sample code/tutorial links on how to write Transaction code ?

The application I am working involves multiple queries for user action. For instance, if admin changes the start date for a course, I have to execute 3 queries in the back end for the changes to update.

Thanks

Srinivas
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2503
    
    8

srinivas chary wrote:...I am noob to Transaction code in JDBC. Can you please give sample code/tutorial links on how to write Transaction code ?
...
Here's SUNs tutorial: Using Transactions (The Java™ Tutorials > JDBC(TM) Database Access > JDBC Basics)


OCUP UML fundamental and ITIL foundation
youtube channel
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Concurrent updates/deletes