This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.net.SocketException: Broken pipe

 
Hendra Kurniawan
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hendra,
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,
Avi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic