Solved

Servlet, RMI, CORBA - which onen to choose

Posted on 1998-05-07
4
288 Views
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
0
Comment
Question by:henrikhansenTSE
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
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.
0
 
LVL 5

Expert Comment

by:fontaine
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.
0
 
LVL 6

Expert Comment

by:gadio
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.
0
 
LVL 5

Expert Comment

by:fontaine
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:

http://jserv.javasoft.com/index.html
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
hash value 2 38
factorial example challenge 10 62
countPairs challenge 7 58
Exception after setting jdbc session management 2 38
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.

757 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

23 Experts available now in Live!

Get 1:1 Help Now