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.  [ 1 post ] 
Author Message
 Post subject: SQLException when using multiple DataSources
PostPosted: Wed Mar 09, 2005 5:31 am 
Newbie

Joined: Wed Mar 09, 2005 4:25 am
Posts: 9
Location: Hamburg, Germany
I ausing hibernate 2.1.8 with Bea Weblogic 8 SP4

My config file for my first Database:
<hibernate-configuration>
<session-factory name="mySessionFactory">
<property name="connection.datasource">my dbdata source</property>
<property name="jndi.url">t3://localhost:7001</property>
<property name="jndi.class">weblogic.jndi.WLInitialContextFactory</property>
<property name="hibernate.connection.datasource">jdbc/mydb</property>
<property name="hibernate.dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.jdbc.batch_size">0</property>
<property name="hibernate.jdbc.use_streams_for_binary">true</property>
<!-- transactions -->
<property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">net.sf.hibernate.transaction.WeblogicTransactionManagerLookup</property>
<property name="hibernate.jta.UserTransaction">java:javax/transaction/UserTransaction</property>
<!-- /transactions -->
<!-- Types -->
<mapping resource="de/vet/procalc/model/A.hbm.xml"/>
<mapping resource="de/vet/procalc/model/B.hbm.xml"/>
<mapping resource="de/vet/procalc/model/C.hbm.xml"/>
<mapping resource="de/vet/procalc/model/D.hbm.xml"/>
<mapping resource="de/vet/procalc/model/E.hbm.xml"/>
<!-- /Types -->
</session-factory>
</hibernate-configuration>

I am using a similiar config for another database.

I try to query data from both datasources. DataSources are using the Oracle XA-Driver. When hibernate tries to query the data the following
exception occures:
Full stack trace of any exception that occurs:
SQL operations are not allowed with no global transaction by default for XA drivers. If the XA driver supports performing SQL operations with no global transaction, explicitly allow it by setting "SupportsLocalTransaction" JDBC connection pool property to true. In this case, also remember to complete the local transaction before using the connection again for global transaction, else a XAER_OUTSIDE XAException may result. To complete a local transaction, you can either set auto commit to true or call Connection.commit() or Connection.rollback().

I am using a modified HibernateUtil implementation witch holds the configs, session and tx's for all databases.

I am NOT using EJB's. I use Hibernate from within the webcontainer.

I am using Oracle 9i with the latest 10g Driver


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.