• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Doubt in JavaServerPages and in JavaBeans???

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic