-->
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: Cannot open connection
PostPosted: Tue Dec 06, 2005 1:02 am 
Beginner
Beginner

Joined: Sun Dec 04, 2005 4:28 pm
Posts: 24
org.hibernate.exception.GenericJDBCException: Cannot open connection
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:307)
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:109)
org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:105)
org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
org.hibernate.loader.Loader.doQuery(Loader.java:661)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
org.hibernate.loader.Loader.loadEntity(Loader.java:1782)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:93)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:81)
org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2729)
org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:82)
org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:812)
org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:772)
org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:62)
org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98)
org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:158)
FileToSave$$EnhancerByCGLIB$$8691d1b6.getType(<generated>)
Upload.doPost(Upload.java:58)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419)
org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

-----------------


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 06, 2005 1:07 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
elaborate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 06, 2005 1:16 am 
Beginner
Beginner

Joined: Sun Dec 04, 2005 4:28 pm
Posts: 24
Testing hibernation loading...

SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
System.out.println("Hello2");
// This step will retrieve an instance FileToSave from the database.
// If you have the Name, you can use a Session to return it:
FileToSave saveFile =(FileToSave)session.load(FileToSave.class,"somepicture");

System.out.println(saveFile.getName());
System.out.println(saveFile.getType());
System.out.println(saveFile.getSize());
-----------

<hibernate-mapping>
<class name="FileToSave" table="filetosave">
<id name="name" column="name" type="java.lang.String"/>
<property name="type" column="type" type="java.lang.String"/>
<property name="size" column="Size" type="java.lang.Long"/>
</class>
</hibernate-mapping>

-------------
org.hibernate.exception.GenericJDBCException: Cannot open connection
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:307)
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:109)
org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:105)
org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
org.hibernate.loader.Loader.doQuery(Loader.java:661)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
org.hibernate.loader.Loader.loadEntity(Loader.java:1782)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:93)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:81)
org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2729)
org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:82)
org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:812)
org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:772)
org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:62)
org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98)
org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:158)
FileToSave$$EnhancerByCGLIB$$d19556f0.getSize(<generated>)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 06, 2005 2:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Please go to the user forum; thanks.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Hibernate.cfg.xml and mysql database
PostPosted: Tue Dec 06, 2005 6:54 pm 
Beginner
Beginner

Joined: Sun Dec 04, 2005 4:28 pm
Posts: 24
dennisbyrne wrote:
elaborate


Correction: This problem has been solved by looking into hibernate.cfg.xml file.


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.