aspose file tools
The moose likes JDBC and the fly likes Concurrent result set ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Concurrent result set ?" Watch "Concurrent result set ?" New topic
Author

Concurrent result set ?

jhun kam
Greenhorn

Joined: Dec 05, 2001
Posts: 18
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

Joined: Oct 12, 2001
Posts: 1179

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


Regards, Rene Larsen
Dropbox Invite
jhun kam
Greenhorn

Joined: Dec 05, 2001
Posts: 18
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

Joined: Oct 12, 2001
Posts: 1179

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

Joined: Dec 05, 2001
Posts: 18
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 ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Concurrent result set ?
 
Similar Threads
Expert Oracle JDBC Programming - book promotion topic
Yes! Passed! 388/400
How to automatically push data
Java application Microsoft SQL server
Need advise on live connection with the Database