Hi Alil,

probably I didn't exactly understand the problem, but what hinders
you from issuing three SQL queries instead of one, using three
different database connections, if necessary? Then walk over the
ResultSets and finally present the cumulated results to the client.
The tricky thing will be performance, for your servlet will have to
wait until either all three queries returned or timeout occured.
As I understand, asynchronous solutions are out of discussion
when it comes to displaying the overall result. But still, at least
I'd execute the queries in parallel. Guess I'd delegate the whole
problem to some specialized Controller class handling the de-
tails of information retrieval (which would spawn appropriate
threads for each database query and keep general control
over the whole issue), return the results in a Vector (Vector
is slow, but thread-safe) or something and finally let the
servlet display the overall result. Note that the servlet will
have to wait during the entire process, so I'd suggest to
either do all that stuff in synchronized code (atomic i.e.
single thread behavour is necessary in this case anyway)
or - better - have the servlet implement 'SingleThreadModel'
(just a 'tagging interface' anyway, look up the API docs for
details). Can't explain the details here, but 'SingleThreadModel'
at minimum gives the server a chance to spawn multiple
servlet instances (though this behavior is implementation
specific), whereas  'synchronized' may block the entire
application. Regardless of how you implement the final
solution, be watchful about this issue in particular,
especially if the queries may take some time (always
keeping a timeout in mind).

HTH,

-- Chris (SCPJ2)

----- Original Message -----
From: Halil AKINCI
To: [EMAIL PROTECTED]
Sent: Monday, June 24, 2002 10:33 AM
Subject: query three remote databases at the same time


Hi,

How can I query three remote databases at the same time using servlet? I
want to send a parameter this databases using a HTML form. Remote servers
receive this parameter, execute query and send results to client. I want to
display all results (that remote databases send) one HTML page.

How can do that?

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to