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.
Joined: Jan 31, 2011
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
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.