File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Critical Please advice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Critical Please advice" Watch "Critical Please advice" New topic

Critical Please advice

peter brews

Joined: Feb 11, 2002
Posts: 20
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

Joined: Feb 21, 2002
Posts: 313
Consider posting the code. Without it we'd just be guessing...

Byron Estes<br />Sun Certified Enterprise Architect<br />Senior Consulant<br />Blackwell Consulting Services<br />Chicago, IL<br /><a href="" target="_blank" rel="nofollow"></a>
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
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.

I agree. Here's the link:
subject: Critical Please advice
It's not a secret anymore!