Hi all,

I have a problem with hibernate and postgresql that I suspect might be
related to Matt Raible's Oracle problems. Every time hibernate does
it's stuff to update the database, postgres spawns another "idle in
transaction" process. Eventually it gives up and the driver throws: -

Backend start-up failed: FATAL 1:  Sorry, too many clients already

        at 
org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:306)
        at org.postgresql.Driver.connect(Driver.java:122)
        at java.sql.DriverManager.getConnection(DriverManager.java:512)
        at java.sql.DriverManager.getConnection(DriverManager.java:140)
        at 
cirrus.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:81)

An example of my code: -

<pre>
      Session hibSess = null; 
      Transaction tx = null; 
 
      try 
      { 
         hibSess = getHibernateSessionFactory().openSession(); 
         tx = hibSess.beginTransaction(); 
 
         Survey survey = null; 
 
         try 
         { 
            survey = (Survey) hibSess.load(Survey.class, id); 
         } 
         catch(ObjectNotFoundException e) 
         { 
            survey = new Survey(); 
[5~            hibSess.save(survey, id); 
         } 
         log.info("Setting form survey to "+ survey); 
 
         sform.setSurvey(survey); 
 
         log.info("Committing transaction"); 
         tx.commit(); 
         log.info("Committed transaction"); 
         hibSess.close(); 
      } 
      catch(HibernateException e) 
      { 
..
</pre>

And hibernate.properties reads: -

hibernate.connection.driver_class=org.postgresql.Driver 
hibernate.connection.url=jdbc:postgresql://localhost:5432/survey 
hibernate.connection.username=XXX 
hibernate.connection.password=XXX
hibernate.dialect=cirrus.hibernate.sql.PostgreSQLDialect 

Any ideas gratefully received - is this standard behaviour for
hibernate? Do I need to reconfigure postgres to cope?

thanks,

jim


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to