Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Connection issues need help

balaji anatha padmanaban
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am using Hibernate in our project.We are making the transcation by using Session s=getCurrentSession() and and the transcation is begin by using s.beginTranscation().Once the transcation is completed,we closing the transcation,but in many of the code session is not clossed.This is the process we are doing in many part of the code.
Now we are facing a big issue with oracle10g.
Oracle is showing that the sessions are not closed.
ba1231@pida4001> ps -ef |grep picte1d
oracle 200794 1 0 Sep 16 - 0:10 ora_dbw0_picte1d
oracle 266356 1 0 Sep 16 - 0:12 ora_smon_picte1d
oracle 458904 1 0 Sep 16 - 0:05 ora_mman_picte1d
oracle 495838 1 0 Sep 16 - 0:35 ora_pmon_picte1d
oracle 504062 1 0 Sep 16 - 0:16 ora_psp0_picte1d
oracle 508152 1 0 Sep 16 - 0:12 ora_lgwr_picte1d
oracle 512250 1 0 Sep 16 - 0:34 ora_ckpt_picte1d
oracle 516348 1 0 Sep 16 - 0:00 ora_reco_picte1d

The above shows that in a oracle instance these many sessions are still open.Actually what happend is it is e allowing the upto 100 sessions to open and once 99 session are opened and the oracle
Database itself locked we are not able to coonect the DB.

We need to clear why this is hapening? and where we need to check the code?

If you need any details let me know.
Waiting for the reply.
k.siva prasadreddy
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I hope you are getting the problem because of whenever you are calling getCurrentSession() you are not getting already existing session, you are getting a new session.

One way of solving this problem is to do as follows:

// open session
session = sessionFactory.openSession();
//start transaction
txn = session.beginTransaction(0;
//do your work
//close transaction
//close session

K. Siva Prasad Reddy.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!