Solved

RMI Applet/server communication and connecting to a database

Posted on 2002-04-20
9
233 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
table example 4 32
eclipse apache tomcat admin console 52 122
String array comparison 4 38
sql import cannot be resolved jsp 3 49
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

828 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