-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate with Oracle
PostPosted: Sat Jun 07, 2008 11:18 am 
Newbie

Joined: Sat Jun 07, 2008 10:54 am
Posts: 2
Hello friends of the forum ...
I am developing a Web application with Java + Hibernate and Oracle BD. Everything goes well. The problem is when I leave for a good time (2 or 3 hours) without doing anything that I get the following error:

[WARN] SQL Error: 17002, SQLState: null
[ERROR] Excepción de E/S: Connection timed out
[INFO] ERROR LOG
exception.getMessage() = could not execute query
exception.getMessage() = [Ljava.lang.StackTraceElement;@1fbafbb
exception.getCause() = java.sql.SQLException: Excepción de E/S: Connection timed out
exception.fillInStackTrace() = org.hibernate.exception.GenericJDBCException: could not execute quer
y


and when I do run, I get this error:

[WARN] SQL Error: 17008, SQLState: null
[ERROR] Connection closed
[INFO] ERROR LOG
exception.getMessage () = could not execute query
exception.getMessage () = [Ljava.lang.StackTraceElement; @ e01873
exception.getCause () = java.sql.SQLException: Connection closed
exception.fillInStackTrace () = org.hibernate.exception.GenericJDBCException: could not execute query


My configuration of my hibernate.cfg.xml file is:

<? 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">
<hibernate-configuration>
<session-factory>
<property name="hibernate.bytecode.use_reflection_optimizer"> false </ property>
<property name="hibernate.connection.driver_class"> oracle.jd bc.driver.OracleDriver </ property>
<property name="hibernate.connection.password"> password </ property>
<property name="hibernate.connection.url"> jdbc: oracle: thin: @ Host: 1521: DBXXXX </ property>
<property name="hibernate.connection.username"> username </ property>
<property name="hibernate.dialect"> org.hibernate.dialect.Ora cle9Dialect </ property>
<property name="current_session_context_class"> thread </ property>
</ session-factory>
</ hibernate-configuration>



please help!


Att. Javi


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 07, 2008 11:55 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hello,
connections have timeouts, so you probably want to use a connection pool.
Most applications servers have good connection pools, but you should use a DataSource in that case and not encode your connection options in your hibernate configuration.

If you don't use an application server you may want to configure C3p0,
look at hibernate docs
http://www.hibernate.org/214.html
or the c3p0 website
http://sourceforge.net/projects/c3p0
in the c3p0 package you'll find a good explanation for alla parameters, and some additional info especially for Oracle.

Actually if you are using Tomcat it would be much easier to use JBoss instead.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 08, 2008 10:40 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Is this a web based application, or a stand-alone Java application?

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.