Hai
Experts , Analysts and all

This topic is about the Method of using a Connectiion in a JSP Project where
Hundreds of users will be using the system simultaneously

In my project( jsp ) i am using a Connection Bean (for database)
I want you to Evaluate  which of these Two process is efficient

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)


sample code

<jsp:useBean id="db1" class="DBConnect.DBConnect" />
<%
 db.connect(); // returns the status of the connection Boolean
 String query=" select * from test";
  try
     {
        ResultSet rs=db1.execSelect(query);
        while(rs.next())
          {
             .......
                     }
          }
   catch(SQLException sqlex) { }
db.close();

%>

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)


I Request all of you to Evaluate and result out the Best Effecient Process
out of these two

In process 1 i am opening and closing the connection after my req is
completed where ever required .


Regards
SriHari

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