[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Servlet, RMI, CORBA - which onen to choose

Posted on 1998-05-07
Medium Priority
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 90 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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:
Suggested Courses
Course of the Month19 days, 7 hours left to enroll

873 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