I generally use Vector. I see Storage optimization here. Some useful code
for you.
Vector dbcvec = new Vector();
try {
ResultSetMetaData rsmd = rs.getMetaData();
int numofcols = rsmd.getColumnCount();
int colcount = 0;
Integer numcols = new Integer(numofcols);
String[] colnames = new String[numofcols];
String[] coltype = new String[numofcols];
dbcvec.add(numcols);
while(colcount<=(numofcols-1)) {
colnames[colcount] = rsmd.getColumnName(colcount+1);
dbcvec.add(rsmd.getColumnName(colcount+1));
coltype[colcount] =
rsmd.getColumnTypeName(colcount+1);
dbcvec.add(rsmd.getColumnTypeName(colcount+1));
colcount++;
}
dbcvec.add("DATA");
colcount = 0;
while(rs.next()){
while(colcount<=(numofcols-1)) {
// System.out.println(colnames[colcount]);
dbcvec.add(rs.getObject(colnames[colcount]));
colcount++;
}
colcount=0;
}
dbcvec.add("EOF");
/Ketharinath Kamalanathan
----- Original Message -----
From: "Praveen Potineni" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 10, 2001 10:45 AM
Subject: Re: A JSP doubt
> Hi Ketharinath,
> I was also doing something similar. Can you suggest which collection
objects
> we can use to store values coming out of database and then send it to the
> JSP. Can you elaboreate. Can you provide code snippets if you could.
> Thanks
> Praveen
>
> ----- Original Message -----
> From: "Ketharinath Kamalanathan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, December 10, 2001 11:35 AM
> Subject: Re: A JSP doubt
>
>
> > Hello Joshy:
> >
> > The ResultSet object needs a database connection to be maintained. You
> > cannot access the ResultSet object without persistent Connection. So,
when
> > you have the ResultSet in the JSP you are trying to have the connection
to
> > the database. By this you are hogging the bandwidth and also suing more
of
> > your database resources.
> >
> > Its a fairly good idea to do the iteration in the Java Class then have
> some
> > collection object passed to the JSP. This eliminates the problems that I
> > have mentioned about previously.
> >
> > Hope this helps.
> >
> > /Ketharinath Kamalanathan
> > ----- Original Message -----
> > From: "JOSHY MON M C" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, December 10, 2001 2:34 AM
> > Subject: A JSP doubt
> >
> >
> > > Hi folks,
> > >
> > > Please answer my following questions
> > > 1 .Is it a good practice to use the Resultset object directly on a JSP
> > page
> > > ? ( eg: for iterating employee recordet and displaying employee list )
> > >
> > > 2. Instead, if I iterate the same recordset in a Jave class and make a
> > List
> > > of Employee object and return back to the page. Will it be a good
> design.
> > > How is it going to affect the performance.
> > >
> > > Please reply soon.
> > >
> > > Regards
> > > Joshy
> > >
> > >
> >
>
===========================================================================
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > > Some relevant FAQs on JSP/Servlets can be found at:
> > >
> > > http://archives.java.sun.com/jsp-interest.html
> > > http://java.sun.com/products/jsp/faq.html
> > > http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > > http://www.jguru.com/faq/index.jsp
> > > http://www.jspinsider.com
> > >
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://archives.java.sun.com/jsp-interest.html
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > http://www.jguru.com/faq/index.jsp
> > http://www.jspinsider.com
> >
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com