Solved

Creating a biderctional RMI program

Posted on 2011-03-24
3
303 Views
Last Modified: 2012-05-11
Hi
i have an RMI program that can get data from the server(CacheRowSet object).
I would like to give the client the possibilty to update a row in the table send it to the server and the server will update DB and clients.
right now the program can update DB and clients but can't get data change from clients.
I will be hppy to hear any suggestions for doing so .
Thanks
0
Comment
Question by:deko007
  • 2
3 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 250 total points
Comment Utility
In order to do so you need to have in your RMI server part
another method which will do update of the database.
Everything else remains the same, you just need to add additions method
to the server and to the Remote interface and you have method
say

boolean UpdateTable(String s)

and your string may be an SQL string which you'll generate on the client and send it to
RMI sever and return value can tell you whether the update was successful or you can make it return integer
and it will tell you how many rows were updated

You don't need any special RMI for that purpose - just another method within your RMI server.

And of course you can keep it all eve within one method and
spcify in its parameters if you want to update or to select.

Probably with two metods it will be cleaner - these decisions more depend on
how often you'll run selects and updates, at waht times, etc.
But RMI as it is is fully equipped for handling this situation - I used both ways a lot.
0
 

Author Closing Comment

by:deko007
Comment Utility
Thanks
I didn't program that,but your solution suond very good solution' i am going to implement it
0
 
LVL 47

Expert Comment

by:for_yan
Comment Utility
Yes, it works for me for many years.
Let us know in case you have any questions.
In general, RMI in my mind is in many cases a very convenient and underappreciated technology,
much easier to imlement and with smaller overhead than say web services.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now