-->
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.  [ 4 posts ] 
Author Message
 Post subject: Got "Cannot open connection"
PostPosted: Thu Feb 19, 2009 5:42 pm 
Newbie

Joined: Sun Feb 01, 2009 6:29 pm
Posts: 15
Hello
I Have web application, its running ok, but when I'm adding a record to the database (MySql), continue with the web application, after 3 request I got that Exception:

org.springframework.dao.DataAccessResourceFailureException: Cannot open connection; nested exception is org.hibernate.exception.JDBCConnectionException: Cannot open connection
org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:612)
org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:917)

And I have to restar Tomcat


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2009 7:01 pm 
Senior
Senior

Joined: Tue Aug 01, 2006 9:24 pm
Posts: 120
Could you please post your code along with your configuration for hibernate in spring. This will get you more help.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 20, 2009 3:23 am 
Newbie

Joined: Sun Feb 01, 2009 6:29 pm
Posts: 15
I notic that it not hapand all the time, Here is the code:
hibernate.cfg.xml
Code:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- Generated by MyEclipse Hibernate Tools.                   -->
<hibernate-configuration>

   <session-factory>
      <property name="connection.username">root</property>
      <property name="connection.url">
         jdbc:mysql://localhost:3306/games
      </property>
      <property name="dialect">
         org.hibernate.dialect.MySQLDialect
      </property>
      <property name="myeclipse.connection.profile">
         MySql Connector 5.1.7
      </property>
      <property name="connection.password">xxxxxx</property>
      <property name="connection.driver_class">
         com.mysql.jdbc.Driver
      </property>
      <property name="hbm2ddl.auto">validate</property>
      <mapping resource="com/senserace/hibernatespring/Test3.hbm.xml" />
      <mapping
         class="com.senserace.hibernatespring.countries.Country" />
      <mapping
         class="com.senserace.hibernatespring.countries.CountryGroup" />

   </session-factory>


need more code?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 20, 2009 9:47 am 
Senior
Senior

Joined: Tue Aug 01, 2006 9:24 pm
Posts: 120
definitely need more code!

As a standard I would make sure you post everything relevant for a faster reply.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.