-->
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: How to test if connection was established ?
PostPosted: Wed Sep 17, 2003 10:21 am 
Regular
Regular

Joined: Tue Aug 26, 2003 3:34 pm
Posts: 54
Location: Farroupilha - Brasil
When I start my application I call Configuration.buildSessionFactory(). If an error occurs while hibernate try to connect database, to get metadata or anything, I would like to handle this error, however hibernate isn't throwing an exception ... even if use openSession() I have an error !!!

How can I test if connection was established ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 17, 2003 11:38 am 
Beginner
Beginner

Joined: Fri Sep 12, 2003 12:54 pm
Posts: 20
I get an exception during Configuration.buildSessionFactory() if my database connection fails.

I'm using DBCP for the connection datasource - perhaps behavior varies depending on how you've configured Hibernate to obtain its connections?

james


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 17, 2003 12:00 pm 
Regular
Regular

Joined: Tue Aug 26, 2003 3:34 pm
Posts: 54
Location: Farroupilha - Brasil
I'm not using DBCP !!! In my case it isn't necessary ...
Heres my config file:

hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect
hibernate.connection.driver_class org.postgresql.Driver
hibernate.connection.url jdbc:postgresql://192.168.0.254/somedb
hibernate.connection.username someuser
hibernate.connection.password somepass

hibernate.connection.pool_size 0
hibernate.statement_cache.size 0
hibernate.show_sql true

I'm using the default configuration.


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.