This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Broken pipe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark " Broken pipe" Watch " Broken pipe" New topic
Author Broken pipe

Hendra Kurniawan
Ranch Hand

Joined: Jan 31, 2011
Posts: 239
I've been trying to integrate pooling in my app. But there are times I get this stack trace when accessing database:

My guess is that the pooling handed me a coneection, and the pooling terminated that connection object. So when I try to call con.close from my app, I got this exception. Do I guess correctly? hat's the solution for this problem? I'm using commons dbcp.
Hendra Kurniawan
Ranch Hand

Joined: Jan 31, 2011
Posts: 239
Everything works just fine in my home PC, but when I put it in remote server, the errors just keep on coming. What could be the problem? Thanks
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1138

You wrote:
But there are times I get this stack trace when accessing database

I understand then that the error you are getting is intermittent.
In that case, I'm guessing the problem is caused by a timeout that is configured in the connection pool.
From the stack trace you posted, I get the impression that you are keeping the database connection open while the user browses your Web page and sometimes the user browses for such a long time that you hit the connection pool timeout.
If that is the case, I suggest reviewing your code.
Obtain a database connection immediately prior to performing a database operation and release the connection as soon as the operation has completed.
Are you hanging on to the database connection because you think that by doing so you are improving performance?
That is precisely the reason for using a connection pool, so that you don't have to keep the database connection open all the time in your app code.

Good Luck,
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Broken pipe
It's not a secret anymore!