Solved

RMI Applet/server communication and connecting to a database

Posted on 2002-04-20
9
234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

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!

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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:

749 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