Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Critical Please advice

 
peter brews
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a application running on Weblogic. We have developed a Java class which gets a connection from the connection pool and have methods to get Statemet Objects on the connection. from the client code example: JSP we instansiate this class to get the Connection object and the Statement object and execute queries.
There seems to be a potential problem in the sense that there is Statment Contention. Exampele : 2 Statement Objects A & B are getting executed Statment B completes its operations but A is still open when we call the closeStatement method on Statement object B it seems to be closing Statemnt A which causes a lot of problems.

Could you please advice
 
Byron Estes
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider posting the code. Without it we'd just be guessing...
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not quite sure, this is the type of response you are looking for, but like Byron stated above, some code would help, but I will take a guess.
My suggestion would be is that you create a Data Access Object which handles all of the access to the database internally, i.e. connection, statement. This particular bean would reside in session scope or maybe application scope.
I would expose certain service methods such as for example query(String str), update(Object obj)
add, delete, you get the idea. Something similar to, I guess a stateless bean. The methods acquire and release resources during a method call.
The key point is that the methods acquire and release resources during a method call.
Like a said, I am not sure if this will help or not. Maybe some code will shed more light.

Craig.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic