Servlet, RMI, CORBA - which onen to choose

Posted on 1998-05-07
Last Modified: 2013-11-24
I am having trouble figuring out which solution model to choose for my next project. Here's the scene:

I have a webserver, which contains a database (these might reside on another server). From an applet (or HTML document) I want to do a query against the database, and present the result as a HTML page. That's all...
The server is running UNIX, and I don't if it is servlet enabled.

I've been reading some postings here and other places. There are several ways to do this, right?

1) Use an servlet to pass on the query to the database and generate the HTML file to send back to the client's browser.

2) Use RMI to call a remote method which do the same as above.

3) Use CORBA to invoke an object on the server

Which one to choose?  Why? and where can I find more info?

Please help...

Thanx in advance
Question by:henrikhansenTSE
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
  • 2

Accepted Solution

msmolyak earned 30 total points
ID: 1220695
Basically, what you need is a Java application which runs on your web server which can serve as a liason between your applet and the database. The issue is - how you communicate between the applet and the server-side app. The three ways to do it are sockets, RMI and CORBA.  If you are going to implement pure Java solution (i.e. you do not expect your applet to talk to C++ program, then use RMI since it is somewhat easier to use and you do not have to leave the confines of Java. Sockets are too low level. Use them only if you need to squieze every bit of performance. CORBA is fine but it is more complicated than RMI (you have to use IDL in addition to Java). Plus RMI is available in JDK 1.1. CORBA support (free one) is only coming with JDK 1.2.

Expert Comment

ID: 1220696
For me, servlets are the best choice. Here are my arguments.

- servlets do not require, when building the applet, any "special technology"  which could not be understood by all browser VMs. This is a definite advantage compared to RMI and CORBA (RMI is JDK 1.1 and CORBA is currently not included in the JDK, although some browsers come with a CORBA ORB);

- you need a simple mechanism to display the HTML containing the results of the query. With the servlet solution, you can trigger the servlet using the GET method and use the showDocument(URL url, String target) provided by AppletContext to directly display the HTML in a browser window. With RMI and CORBA, you will face the problem of displaying the HTML. Indeed, all you will be able to do is to get the HTML in the applet, what isn't that much usefull. CORBA and RMI would have interest, however, if you were planning to format the data in the applet (in a spreadsheet-like Java component for example). But this is not the case;

- if the user is behind a firewall, CORBA and RMI will use HTTP tunneling (i.e. each request will be embedded in an HTTP request) because most of the time, the only protocol that will be accepted by the firewall is HTTP. More, if the user has to deal with a paranoaic implementation of the firewall, only HTTP on port 80 will be accepted. If you want to be able to serve this kind of user too, you will have to set up a script on the Web server (which is on port 80 and uses HTTP) to redirect the request to the CORBA or RMI server (RMI listens on port 2000). Complicated, isn't it? With the servlet solution, no problem can arise.

Expert Comment

ID: 1220697
henrikhansenTSE, I'd like to add to this discussion that no one mentioned the oldest trick in the book - the CGI. If your browser is not servlet enabled then this solution is far more simple then all the others. You write an executable (script or compiled code) that gets parameters from the server and sends out on the standard output the html result page. I think that fontaine have some good arguments, and they can be applied also for the CGI-BIN 'old'  technology.

Expert Comment

ID: 1220698
I totally agree with you, gadio! However, servlets are from far better than CGI for databases. Indeed, the CGI script has to open a connection to the database for each request (as its process simply dies after having answered to the request), what is time consuming. The servlet can connect to the database at initialization time and, as it remains in memory, the connection is ready for use by all subsequent requests. Also, the coding of the script is made easy thanks to the use of JDBC.

I don't know what henrikhansenTSE's server is. Apache, maybe? If yes, there should be a servlet support. There also exists some kind of bridge allowing a UNIX server to run servlets via an intermediate CGI script. In this case, however, your servlet will have to reconnect to the database for each request. More information on servlets can be found here:

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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 the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

707 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