The important thing is to put all the DB access code in one class. If this class if a
JavaBean then you can use 2 directly. If not, you can write a JavaBean to use the DB
access class as per method 2. The other alternative is to have a servlet use the DB
access class as per method 3. Either way, put all the database access logic in one or
a few classes so if you need to change any of the DB connection info it's all in one
place.
You definitely don't want to ever be using method 1 as it's not maintainable.
-- Marc
> -----Original Message-----
> From: Mahesh Chhatlani [mailto:[EMAIL PROTECTED]]
> Sent: January 17, 2001 10:34 AM
> To: [EMAIL PROTECTED]
> Subject: JSP to database communication
>
>
> Hi,
> Which is the "suggested" way to access the database, say for
> an intermediate
> query that throws out about 100 rows.
>
> (1) JSP to db directly on a JSP page
> (2) JSP to JavaBean (where the bean has all the db access)
> (c) JSP to Servlet (where the Servlet accesses the db)
>
> For quick login checks, etc I use the 1st method.
> What about queries that throw out more than 1000 rows? Which
> method is the
> "suggested" one?
> Thanks.
> --mahesh
>
> ==============================================================
> =============
> 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://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
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://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets