File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

This connection has been closed ERROR!!

 
Eduardo Ponce de Leon
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was creating a class for accesing my DB and designing a query to display some information in my JSP page and as I was testing all of a sudden I am getting an error and all of a suddend i am starting to get this error and I have no idea why..



Can anybody help on this!!
 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 196
Java Oracle Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you are trying to create multiple connections in a loop and close them after use. In that order somewhere your code is trying to use closed connection and throwing the exception.
We can see that in the exception log.
 
Murad Iqbaal
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Was this working before? Once, I also encountered this connection closed error, it was a pain to resolve. Make sure you are not using select * in your query. Pick up table fields by their names and try.
 
Martin Vajsar
Sheriff
Pie
Posts: 3747
62
Chrome Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Murad Iqbaal wrote:

Was this working before? Once, I also encountered this connection closed error, it was a pain to resolve. Make sure you are not using select * in your query. Pick up table fields by their names and try.

Certainly select * should be avoided, but how could it cause the closed connection error?
 
Murad Iqbaal
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


It was thrown by WebSphere App Server 7.01. It did not make sense that is why it was hard to track. When we changed the select *, it started working.


Also, try deleting and recreating your data source.
 
Deepak Rao
Ranch Hand
Posts: 35
Eclipse IDE Firefox Browser
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It was thrown by WebSphere App Server 7.01. It did not make sense that is why it was hard to track. When we changed the select *, it started working.

Sometimes when the time out property is set on the connection pool of the application server, it forcibly releases the connection back to the pool after the specified period(ie.whatever is specified in the property,like 300 seconds etc). In which case you get the Connection has been Closed error.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic