• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Concurrent result set ?

 
jhun kam
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ranchers !
I'm doing a simple Swing-based GUI application that can view, modify, add, delete records that are stored in a DB table. This application could be used by multiple users, and i have a problem with this:

How do i actually have the records updates or additions or deletions by one client be known by other clients that also use that application.

I'll describe a little about the GUI. It has a simple JDialog that has JTextFields, JCheckBoxes, etc that represent a Table record. The JButtons for going to the next record, going to the previous record, saving changes(update), adding, deleting record, etc are placed there too.
I use the SQL statement 'select * from TableName;' and keep all the records in a LinkedList, so i can do the prev and next easily as i dont need to have the DB server execute an SQL statement just for the next or previous record. Every updates made renders updates in my DB Table and my LinkedList representing my Table records.
All things went quite well until i realized that my current application only work with a single user in a single computer. If my application is to be used by many users, every user will maintain their own linked list that doesnt know what other users have done to the Table records.
Is it possible to have other users, that also use the same application, know what changes i've made to the records in a Table ? Please, any idea would help. Thanks.
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to have some sorte of server the clients can access the database through.
You should try look at the RMI - here is one link:
http://java.sun.com/docs/books/tutorial/rmi/index.html
/Rene
 
jhun kam
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you think i should have all the clients connect to the DB through a kind of middleware, which is a remote object ? And all the prev, next, add, delete, update operations are done through the method calls of the remote object ?
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, this way you can control the clients access to the database - and you can even make some RMI callbacks to the clients if you e.g. want to give messages to the clients.
The important think here is that there is some kind of central unit that the clients have to pass.
/Rene
[ July 18, 2002: Message edited by: Rene Larsen ]
 
jhun kam
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the idea. I am currently trying the RMI, all the stuffs with creating an interface, remote object implementation, the server residing in registry, the stub n skeletion via rmic, and the client. Things are going quite well. But how am i supposed to do callbacks to the clients ? How can i reference them ? Could a client send their reference(this keyword) through a remote method call, and be called from the remote object ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic