Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

RMI Applet/server communication and connecting to a database

Posted on 2002-04-20
9
Medium Priority
?
240 Views
Last Modified: 2013-12-29
I am using RMI between an applet and a server. The RMI server is located on a machine called sun4 and part of what I needed to do was to allow a user to query, through the applet in a browser , a database located on another machine called macneill.

I kept getting security exceptions and couldn't understand why.  Eventually on "guess" advice from someone who suggested that the problem might be the second connection (ie the connection to macneill) since an applet can only connect to a server from which it is downloaded.

I relocated my RMI server to macneill and sure enough all is working. I don't understand why this should be.  This implies that the applet was trying to connect to macneill but I understood the whole point of RMI was that the server would carry out such connections and therefore working around the problem of an applet not being able to make a separate connection.

Why should it be a problem for the server to connect to a separate machine? Was I doing something wrong or is this to be expected? Unfortunately I need to clarify this for a detailed write up on the project

any help would be really appreciated.
thanks
Liz
0
Comment
Question by:Cleare
9 Comments
 
LVL 92

Expert Comment

by:objects
ID: 6957124
Liz,

Were you making your db queries thry the RMI server, or were you making them directly? If you're making them directly then RMI is not even involved.
0
 

Author Comment

by:Cleare
ID: 6957681
All the code to submit the queries was in the Implementation which admittedly was a separate class to the Server.  How could RMI not be involved if i have a server, client and have rmi compiled them?  
0
 
LVL 92

Expert Comment

by:objects
ID: 6958365
RMI is only used to talk to the RMI server.
JDBC and RMI are totally unrelated.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Cleare
ID: 6968214
i know they're unrelated but the problem is why can the server not carry out the JDBC stuff from a machine that is not necessarily the same machine as where the databse is?  I don't want or need the applet to connect directly to the database I understood that all that could be done on the server side.

What has happened implies to me that the implementation code is downloaded to the applet as well as the appletcode.  This would raise the problem that the applet cannot talk both to the server on one machine and the databse on another machine.

Is this the way RMI is supposed to work?

I thought the point of it was that the real implementation was carried out on the server side therefore eliminating any problems with the applet trying to connect to more than one machine.

I'm need to establish exactly where the implementation is being carried out.  Is it on the machine the applet is being downloaded to or is it on the server regardless of where the applet is?
0
 
LVL 92

Expert Comment

by:objects
ID: 6969875
Are your JDBC calls being made by the applet or the RMI server?
0
 

Author Comment

by:Cleare
ID: 6973206
All the JDBC code is in the server.  But now that you say it the methods that contain all the JDBC stuff are called on the interface in the applet.

For example the applet would contain the following:

private SInterface interface;
...
//set up GUI
//take in headword parameter from user
...

interface.findword(headword);

The method findword(String headword) is in the Implemetation and contains JDBC code.

I have 4 principle classes: the Server, the Implemetatio (all JDBC code is in here) the Interface and the applet.

I understood that calling those methods on an object of the interface means that they methods aren't beinng carried out on the applet side but remotely i the server.  Am I understanding that correctly?

thanks for replying so often this is really important....
Liz


0
 
LVL 92

Expert Comment

by:objects
ID: 6974411
Can you post the stack trace for the security exception uo are getting.
0
 
LVL 9

Expert Comment

by:Venci75
ID: 7972657
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ'd and pts removed
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venci75
EE Cleanup Volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8021381
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

783 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