-->
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: Setting OracleDataSource specific properties
PostPosted: Tue Jul 11, 2006 3:26 pm 
Newbie

Joined: Tue Jul 11, 2006 3:10 pm
Posts: 3
Hi

Is there a way to set up an specific OracleDataSource, in persistence.xml (or even in Java Code)?

What I need, is to set a specific ConnectionProperty ("oracle.jdbc.ReadTimeout") for OracleDataSource.

In a programmatic Way, I can do that by calling setConnectionProperties().

Properties cnProps = new Properties();
cnProps.setProperty("oracle.jdbc.ReadTimeout", 10000);

ods = new OracleDataSource();
ods.setConnectionProperties(cnProps);

This is a VERY important parameter (and not very docummented), that prevents thread blocking, when database is non reachable .

How can I set Hibernate to pass this property to OracleDataSource?

Thanks
JM


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 3:28 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
How are you using this DS?
Container managed (which container) or standalone (SE)?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 2:54 pm 
Newbie

Joined: Tue Jul 11, 2006 3:10 pm
Posts: 3
I am planning to use this DS, with Hibernate EntityManager, from J2SE.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 4:20 pm 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Write your own connection provider:

Code:
hibernate.connection.provider_class = <your_provider>


Code:
public interface ConnectionProvider {
   /**
    * Initialize the connection provider from given properties.
    * @param props <tt>SessionFactory</tt> properties
    */
   public void configure(Properties props) throws HibernateException;

        ...


Use a configure(Properties properties) method to set up DS and specific property.

Rgds, Ales


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 6:58 pm 
Newbie

Joined: Tue Jul 11, 2006 3:10 pm
Posts: 3
Great!

I implemented an OracleDatasourceConnectionProvider, that set specific Oracle parameters, from persistence.xml properties.

Thanks a lot.
JM


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.