Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to Close Connection In Case Of java.sql.Exception

 
Shakti Dalabehera
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using weblogic 7.1, Struts, JDBC Thin , Oracle 8i.
Whenever I am getting an exception " java.sql.SQLException: ORA-02392: exceeded session limit on CPU usage, you are being logged off
" and I am trying to close the connections in the finally clause it is not closing.
Due to which jdbcConnectionPoolRuntimeMbean.getLeakedConnectionCount() is always giving me an open connection and this count goes on increasing in whenever this exception occurs.
Now My Question is :
1) Is there an actual connection leak ?
Thanks in advance for help.
Regards,
Shakti
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and I am trying to close the connections in the finally clause it is not closing.


This is only possible if exception occurs before try block starts.

The other problem I can think is your application may have too many requests(ie. threads) which always surpassed your max connection capacity before they are available from other running thread.

If that is the cases you might want to use some load balancing tool(ie. JProfiler) to get the idea of max capacity of your production machine.
 
Shakti Dalabehera
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jignesh for your reply. You are right I am getting this oracle error because too many people are logged in with the same id using TOAD . So I guess i wont' face this issue in production.

But actually I didn't get the answer for question. My Questions is " In the finally clause I have written connection.close() ... and in such a scenario weblogic is throwing an SQL exception while I am trying to close the connection. But when I am checking for any connection leaks using weblogic api ( this is a separate monitoring tool ) I am getting a connection leak .
Please let me know if this is a geniune case of Connection Leak ?
Regards,
Shakti
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic