This is a loaded a question. And an important one to get it right for the
following reasons
1. Flexibility & configurability
2. Scalability
Sending the query from client to the servlet
*********************************************
1). If you can parametrize your query then it is better to put the query in
a config file on the server and have the clients just pass the substitutable
arguments to the server. To keep the reply brief, I am not going to
elaborate on the advantages of this approach.
Sending data from server to the client
**************************************
1. You can not really serialize result set. I don't think it is as much a
problem of the Resultset being not serializable. The reason ( IMHO ) I
believe it was not made serializable is because, these resutlt sets hold
database cursors which will let you step forward( in case of the previous
JDBC spec ) as you need more data. Which means, if you used only 2 of the
million rows that you fetched as a result set, the database only returned
you a few rows only and it never retrieved the full set.
2. So one would like to pass the same benifit to the client where
applicable. To do this you need to have some proxy object on the client
side that behaves similar to a result set but transports your server side
data in a cach/load pattern to the client.
3. One approach is to come up with your own ResutlSet interface that
resembles the original result set but uses either RMI or other possible
communication scheme to provide this caching.
4. What you pass back to the client could serialized objects that were
created on the server or get the raw data to the client and unserialize the
database data on the client side. The second approach is much more common
because the objects need to exist only the client side.
5. Using this approach the client can retrieve objects fron an object cursor
that extends all the way from the client to the database server.
..Satya.
-----Original Message-----
From: Mark Phillips [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 22, 1999 11:24 PM
To: [EMAIL PROTECTED]
Subject: A JDBC - servlet Design Question
I am building an applet-servlet-database application, and I have a design
question.
The applet collects info, builds a query object, sends it to the servlet
(http serialized object), which sends it to the db-server (rmi) to get the
result set. The result set is returned to the servlet (rmi callback), which
sends to the applet (http serialized object), and the applet puts the result
set in a JTable. I want to keep the applet-servlet link simple so I don't
get into any firewall issues. I put the applet-servlet communication
activity in a separate thread so the applet can do other things while
waiting for the response from the db.
My questions are:
1. Should I build a query object, or just send the query as strings in GET?
There are only 5 to 20 parameters in a query.
2. Can I send the JDBC result set back to the applet as a serialized object,
or is it better to "unpack" it at the servlet and send it as my own result
set object?
3. Do I need a connection pool at the servlet? I expect between 2 and 15
simultaneous accesses to the db from different applets.
Any other observations about the architecture would be greatly appreciated!!
Mark
****************************************************
Phillips Marketing, Inc.
Internet marketing, e-commerce, groupware, and new ventures
602 945-0798
Fax 945-9197
[EMAIL PROTECTED]
http://members.home.net/phillipsm
___________________________________________________________________________
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
___________________________________________________________________________
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