-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: help me! Problem when using database:Oracle
PostPosted: Tue Feb 24, 2004 11:08 pm 
Newbie

Joined: Tue Feb 24, 2004 10:46 pm
Posts: 2
I just have a projet to use hibernate to mapping the data on Oracle, it's a web based application. I use Resin as the server. after it runs a few hours, there is the error:
Code:
Cannot open connection: ORA-00604: error occurred at recursive SQL level 1
ORA-00018: maximum number of sessions exceeded

I use a hibernate configure file: hib.cfg.xml like
Code:
<property name="hibernate.dialect">net.sf.hibernate.dialect.OracleDialect</property>
        <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@xxx.xxx.com:8888:what</property>
        <property name="connection.username">you</property>
        <property name="connection.password">me</property>
        <property name="query.substitutions">true=1, false=0</property>
        <property name="show_sql">true</property>
        <property name="use_outer_join">true</property>
        <property name="jdbc.fetch_size">50</property>
        <property name="jdbc.batch_size">20</property>
        <property name="jdbc.use_streams_for_binary">true</property>

and use a singleton SessionManager class to make SessionFactory.
On web tier I use cache for a session through every request then on the end of a request close the session. which means during a request only call
Code:
s = SessionManager.getInstance().openSession();
once; and at end call
Code:
s.disconnect(); s.close();


I'v tried to use resin's connection pool but it always the same, after a period of time it reports can't open connection from full pool!

what should i do? thank's for any help!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 3:47 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
try to configure DBCP on hibernate

<!-- configuration pool via dbcp -->
<property name="dbcp.maxActive">30</property>
<property name="dbcp.whenExhaustedAction">1</property>
<property name="dbcp.maxWait">120000</property>
<property name="dbcp.maxIdle">1</property>
<property name="dbcp.minIdle">0</property>
<property name="dbcp.ps.maxActive">10</property>
<property name="dbcp.ps.whenExhaustedAction">1</property>
<property name="dbcp.ps.maxWait">120000</property>
<property name="dbcp.ps.maxIdle">100</property>
<property name="dbcp.validationQuery">select 1 from dual</property>
<property name="dbcp.testOnBorrow">true</property>
<property name="dbcp.testOnReturn">false</property>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 8:41 am 
Regular
Regular

Joined: Mon Nov 24, 2003 6:36 pm
Posts: 105
I don't see a need for calling session.disconnect at end of the unit of work.

Seems like somehow connections are not being closed.

--James


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 2:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I am pretty sure you are leaking connections somewhere. For a starter don't use the hibernate builtin pool, but use DBCP, c3po or the Containers pool. If that problem stays, double check your code (exception handling, etc)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 5:01 am 
Newbie

Joined: Tue Feb 24, 2004 10:46 pm
Posts: 2
thanks all alot. I'v found the mistake, I use some wrong code to get connection to database.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.