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).
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?
Thanks for your response...
I have developed a Course Registrations web application.
1. Users can check course schedules on the home screen.
2. They can either register for a course/un-register for a course.
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.
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.
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.