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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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:

930 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

14 Experts available now in Live!

Get 1:1 Help Now