• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

JSP error

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using more database connection in my jsp coding so the cpu percentage will be automatically
increased(100%) and my server also very slow response.I need one global database connection in jsp
page and get the connection in my code.How can i solve this problem?Please assist me to solve this problem.



Regards,
Suganya
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using a global DB connection is a big no-no, as you will run into concurrency issues. Use a database connection pool instead (like Apache DBCP), and obtain a connection from it. This should be done in a servlet or a backing bean, not in a JSP (never put JDBC code into a JSP).

Where does the slowness come from - the servlet container or the DB server? Are both running on the same machine? How many concurrent request is the app handling when load becomes an issue? Have the queries and indexes been performance tuned?
 
R Sugan
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf Dittmer,
Thanks for your reply.Please give me any sample code.That is very helpful to solve this problem.



Regards,
Suganya.
 
Ulf Dittmer
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are you looking for in particular that isn't covered by the numerous examples on the DBCP site (which I assume you have checked out)?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It'll be pretty important to identify where the slowdown is occurring--pegging at 100% during a single request to a single JSP should raise a warning flag that something is most likely horribly wrong.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic