I have a simmilar problem... I'm inserting about 12 000 Entities in the DB, and 
after about 8000 it craches thithe the same "Cannot open connection" exception.

The problem is, that connection is obtained and released for each call to 
persist(). See hibernate log:

  | 2006-08-22 21:50:44,889 DEBUG [org.hibernate.jdbc.ConnectionManager] 
opening JDBC connection
  | 2006-08-22 21:50:44,889 DEBUG [org.hibernate.SQL] insert into Team (razdel, 
kod) values (?, ?)
  | 2006-08-22 21:50:44,905 DEBUG [org.hibernate.id.IdentifierGeneratorFactory] 
Natively generated identity: 15842
  | 2006-08-22 21:50:44,905 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to 
close PreparedStatement (open PreparedStatements: 1, globally: 2)
  | 2006-08-22 21:50:44,905 DEBUG [org.hibernate.jdbc.ConnectionManager] 
aggressively releasing JDBC connection
  | 2006-08-22 21:50:44,905 DEBUG [org.hibernate.jdbc.ConnectionManager] 
releasing JDBC connection [ (open PreparedStatements: 0, globally: 1) (open 
ResultSets: 0, globally: 0)]
  | 2006-08-22 21:50:44,905 DEBUG 
[org.hibernate.event.def.AbstractSaveEventListener] executing identity-insert 
immediately
  | 2006-08-22 21:50:44,905 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to 
open PreparedStatement (open PreparedStatements: 0, globally: 1)
  | 2006-08-22 21:50:44,905 DEBUG [org.hibernate.jdbc.ConnectionManager] 
opening JDBC connection
  | 2006-08-22 21:50:44,905 DEBUG [org.hibernate.SQL] insert into TeamName 
(team_id, lang, name) values (?, ?, ?)
  | 2006-08-22 21:50:44,905 DEBUG [org.hibernate.id.IdentifierGeneratorFactory] 
Natively generated identity: 31683
  | 2006-08-22 21:50:44,905 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to 
close PreparedStatement (open PreparedStatements: 1, globally: 2)
  | 2006-08-22 21:50:44,920 DEBUG [org.hibernate.jdbc.ConnectionManager] 
aggressively releasing JDBC connection
  | 2006-08-22 21:50:44,920 DEBUG [org.hibernate.jdbc.ConnectionManager] 
releasing JDBC connection [ (open PreparedStatements: 0, globally: 1) (open 
ResultSets: 0, globally: 0)]
  | 2006-08-22 21:50:44,920 DEBUG 
[org.hibernate.event.def.AbstractSaveEventListener] executing identity-insert 
immediately
  | 2006-08-22 21:50:44,920 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to 
open PreparedStatement (open PreparedStatements: 0, globally: 1)
  | 2006-08-22 21:50:44,920 DEBUG [org.hibernate.jdbc.ConnectionManager] 
opening JDBC connection
  | 2006-08-22 21:50:44,920 DEBUG [org.hibernate.SQL] insert into TeamName 
(team_id, lang, name) values (?, ?, ?)
  | 2006-08-22 21:50:44,920 DEBUG [org.hibernate.id.IdentifierGeneratorFactory] 
Natively generated identity: 31684
  | 2006-08-22 21:50:44,920 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to 
close PreparedStatement (open PreparedStatements: 1, globally: 2)
  | 2006-08-22 21:50:44,920 DEBUG [org.hibernate.jdbc.ConnectionManager] 
aggressively releasing JDBC connection
  | 2006-08-22 21:50:44,920 DEBUG [org.hibernate.jdbc.ConnectionManager] 
releasing JDBC connection [ (open PreparedStatements: 0, globally: 1) (open 
ResultSets: 0, globally: 0)]
  | 2006-08-22 21:50:44,920 DEBUG 
[org.hibernate.event.def.AbstractSaveEventListener] executing identity-insert 
immediately
  | 2006-08-22 21:50:44,920 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to 
open PreparedStatement (open PreparedStatements: 0, globally: 1)
  | 2006-08-22 21:50:44,920 DEBUG [org.hibernate.jdbc.ConnectionManager] 
opening JDBC connection
  | 2006-08-22 21:50:44,920 DEBUG [org.hibernate.SQL] insert into Team (razdel, 
kod) values (?, ?)
  | 2006-08-22 21:50:44,936 DEBUG [org.hibernate.id.IdentifierGeneratorFactory] 
Natively generated identity: 15843
I think there is also perfomance problem here, but don't know how to avoid this.
More info here: http://forum.hibernate.org/viewtopic.php?t=963671

I've checked ConnectionPool Mbean and found there is no connection leak. Only 
one connection were used for this task.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966768#3966768

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966768
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to