This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi friends I am having 5 jsp pages.each jsp page contains one Javabeans in which database connection and relevant results are fetched from the database and the results are returned to the corresponding jsp page.so if i succesffuly logged into my application then for each jsp page i am accessing the javabeans which will connect to the database connection and return the valid results.this will make the response slow. [i think for each request i am opening the database connection and fetch the results and return the results to the corresponding jsp page and close the database connection this will make the response time slow.am i correct???] What i want to know is how can i make the database connection open whenever the user session starts and connection remains open until the session is valid for the particular user.suppose if the session is invalid then the database connection should be closed. [bcos now if you access any jsp pages then the response time is quick compared to previous one.] I dont want to open a database connection everytime if i am accessing the jsp page and closed after the user leaves the page?is it possible thro' connection pooling??? I am using jdbc-odbc driver to connect to the database.is it possible to do like that??? if so...then plz tell me how to do that one??? Also which one is best to access the database records???Servlets or in JavaBeans and why? Also i am coming across one more problem which is better to use???Vector or Hashtable to fetch the records from the database.more accurately which is faster?i know Vector is synchronized so it is not faster compared to arrays.then is there any java.util.collection is there to increase the fetching the data very fastly. Thanks Kumaran.S
Kumaran: No offense, but that was a very lengthy post! Just a friendly suggestion, try to ask what you want in a precise way. If someone needs more info they sure will ask. Secondly, please don't post too many qstns in one post. One thing at a time, is good. You can create a DB connection and instantiate it as a bean on the session object. Its quite possible. To access the db records, I personally prefer a bean rather than a Servlet. Having a bean is easy to test/debug the DB portion of your software. You can do it with a stand alone application without other dependencies. Vector verses Hashtable....ummmm....doesn't matter. Both are synchronized. regds. - madhav