> Process-1:
>
> In each page of pages where i require i am creating the connection bean
> instance by
>
> My Connection bean is executing three basic Functionality
>
> 1.connect() ------returns a boolean object on the status of the connection.
> 2.ExecSelect() --returns a resultsetobject  of the query executed
> 3.ExecDML() ---returns a int on no of rows effected by the execution of the
> query(for insert,delete,Modify)
>

> Process-2
>
> I got a Recommandition from my senoirs that
>
> Creating a Connection object for every Client after login in the Session
> variableand use the Connection object
>
> How?
> 1.Pass the Connection Object to the methods in Other bean or in the jsp page
> and executing the queries

> 2.Passing Connection object and statement objects to bean for execution of
> the query from a jsp page
>
> here i dont have the guarentee of closing the connection not all users may
> Logout( where i have to close the connection)


First let me answer a few hows in process 2.
a. You could just have a method called setConnection(Connection c) in
your beans.

b. You can have a HttpSessionBindingListener to ensure that all
Connections are closed when the session terminates by either user
logging out or session timing out.

I have seen a lot of code and books doing the second way.

Yet, I myself am using the first method most of the time because I like
to design my webapps such that the beans hide all the info about the
database from my jsp pages. The beans act as a layer between the
database (or any other information source) and the jsp pages.

For the actual database connection, I use PoolMan to pool and cache my
interactions with the database. Why don't you try it out at
www.codestudio.com

Hope it helps,
Ashish

===========================================================================
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

Reply via email to