Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

using JDBC with EJB  RSS feed

 
Inesh Hettiarachchi
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
well this is my question
i am using DB2 as the data base and i have written a web application using servlet's the problem is when the application creates morthan 75 db cnnections the database gets stuck and hault all the user's(it's the DB2 is configured)
so i was thinking writing a EJB(session bean) to manage the database connection on the server side so the servlets can use the bean to access the database
all i want to know is,is it practical to do this
and if any one has any other view
or know any other way to do it

thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whether you get a DB connection in a Servlet or in an EJB it doesn't change the fundamental problem: that usage of your application creates a greater demand on DB resources than it is configured to handle. You need to configure your DB to allow more concurrent sessions.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36396
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Inesh",
We're pleased to have you here with us in the EJB forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks,
Jeanne
Forum Bartender
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36396
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using the server's connection pooling feature or trying to manage the connections yourself?
 
Stan Sokolov
Ranch Hand
Posts: 120
Hibernate IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I very curious what type of application have you created. Define connection pool. For example http://homepages.nildram.co.uk/~slink/java/DBPool/
is very simple one. Define attributes of the pool and then whenever you use a pool you can check how many connection are available. If number of open connection is continiously deacrising then you should review your code in order find the place when connection is not closed.
Just in case I will put fragment of code that get connection from the pool and show the current pool status.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!