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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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 how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

813 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

11 Experts available now in Live!

Get 1:1 Help Now