-->
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.  [ 7 posts ] 
Author Message
 Post subject: TransactionException: JDBC begin failed (with informix)
PostPosted: Tue Apr 26, 2005 9:32 am 
Newbie

Joined: Mon Apr 11, 2005 4:55 am
Posts: 16
Hello,

Could you help me with this problem. I have an exception thrown when calling session.beginTransaction() with an Informix database.

But the same application is working fine with a MySQL Database !

The error tell me that transaction are not supported with this base (witch is not true, because we are already using this base in an swing transactionnal application).

I know it is probably not an Hibernate problem, but if you have any ideas !
I am quite knew with Hibernate. You will find here the hibernate config and also the stack trace.

(please note also that the same request, without transaction, is working fine)

Hibernate version: 3.0

Mapping documents:
<hibernate-configuration>
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory name="java:hibernate/SessionFactory">
<!-- properties -->
<property name="connection.datasource">netqi_db</property>
<property name="hibernate.dialect">org.hibernate.dialect.InformixDialect</property>
<property name="hibernate.hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="show_sql">true</property>

<!-- mapping files -->
<mapping resource="WEB-INF/classes/hibernate/Origin.hbm.xml" />
//...
</session-factory>
</hibernate-configuration>

<hibernate-mapping package="com.netqi.business.beans.misc">

<class name="Origin" table="origine_contact" lazy="false">
<id name="id" column="id_origine" type="string" unsaved-value="0" >
<generator class="identity" />
</id>
<property name="name" column="description" type="string" not-null="true"/>

</class>

</hibernate-mapping>


Full stack trace of any exception that occurs:
java.sql.SQLException: Transactions not supported
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:355)
at com.informix.jdbc.IfxSqliConnect.setAutoCommit(IfxSqliConnect.java:1714)
at org.objectweb.jonas.jdbc_xa.ConnectionImpl.setAutoCommit(ConnectionImpl.java:316)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:53)
at org.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:19)
at org.hibernate.jdbc.JDBCContext.beginTransaction(JDBCContext.java:204)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1007)

15:16:25 ERROR [com.netqi.portals.business.BusinessContext] --> PersistenceSessionException
com.netqi.portals.exceptions.PersistenceSessionException: org.hibernate.TransactionException: JDBC begin failed:
at com.netqi.portals.persistence.hibernate.HibernateSession.beginTransaction(HibernateSession.java:35)
at com.netqi.portals.business.BusinessContext.runInTransaction(BusinessContext.java:68)
at com.netqi.portals.business.GenericBusinessService.delete(GenericBusinessService.java:102)
at com.netqi.softwareportal.actions.DeleteAction.deleteOrigin(DeleteAction.java:73)
at com.netqi.softwareportal.actions.DeleteAction.execute(DeleteAction.java:45)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)

Caused by: org.hibernate.TransactionException: JDBC begin failed:
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:58)
at org.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:19)
at org.hibernate.jdbc.JDBCContext.beginTransaction(JDBCContext.java:204)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1007)
at com.netqi.portals.persistence.hibernate.HibernateSession.beginTransaction(HibernateSession.java:33)
... 47 more
Caused by: java.sql.SQLException: Transactions not supported
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:355)
at com.informix.jdbc.IfxSqliConnect.setAutoCommit(IfxSqliConnect.java:1714)
at org.objectweb.jonas.jdbc_xa.ConnectionImpl.setAutoCommit(ConnectionImpl.java:316)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:53)
... 51 more


Name and version of the database you are using:
Informix onLine 7.3

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 26, 2005 10:58 am 
Newbie

Joined: Tue Apr 05, 2005 8:01 am
Posts: 12
Are you executing this in a managed environment or non-managed environment.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 26, 2005 11:31 am 
Newbie

Joined: Mon Apr 11, 2005 4:55 am
Posts: 16
managed, with JoNAS 4.3. I tried those 2 hibernate config :

<property name="hibernate.hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
or
<property name="hibernate.hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>

it is the same result.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 26, 2005 5:00 pm 
Regular
Regular

Joined: Tue Mar 22, 2005 2:27 am
Posts: 62
This is not a hibernate problem.
Your database doesn't have a transaction log enabled, that's why you're seeing: "java.sql.SQLException: Transactions not supported".

You need to set your Informix database instance up correctly.


Top
 Profile  
 
 Post subject: Transactions on informix
PostPosted: Thu Sep 15, 2005 8:38 am 
Newbie

Joined: Thu Sep 15, 2005 8:35 am
Posts: 1
Location: Vincennes/Paris/France
Hi!
You need to have database logging the transactions. No logging, no transactions.
So you just need to create your database with:

create database mydatabase in rootdbs WITH LOG MODE ANSI;


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 11:43 am 
Newbie

Joined: Fri Oct 28, 2005 11:27 am
Posts: 3
Location: Germany
Hallo GabrielKa,

thanks a lot for you post! I had the same problem with
Hibernate 3.0.5 and Informix 9.3 having the latest
jdbc-driver.
After using logging it worked! Good Job.

But what if you cannot re-create (drop and create) a
database cause there's a lot of data in it?
Is there a possibility to turn on logging later? Or
do I have to do a database export and import?

Thanks,
Helmet


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 12:05 pm 
Newbie

Joined: Fri Oct 28, 2005 11:27 am
Posts: 3
Location: Germany
Hi all,

using logging for the database seems ok, but in the hibernate log-file
I found the following stacktrace:

17:03:24,324 DEBUG JDBCExceptionReporter:40 - SQL Warning
java.sql.SQLWarning: Database has transactions
at com.informix.util.IfxWarnMsg.getSQLWarning(IfxWarnMsg.java:125)
at com.informix.util.IfxWarnMsg.getSQLWarning(IfxWarnMsg.java:149)
at com.informix.jdbc.IfxSqliConnect.a(IfxSqliConnect.java:1923)
at com.informix.jdbc.IfxSqliConnect.t(IfxSqliConnect.java:4144)
at com.informix.jdbc.IfxSqliConnect.b(IfxSqliConnect.java:2746)
at com.informix.jdbc.IfxSqliConnect.a(IfxSqliConnect.java:2620)
at com.informix.jdbc.IfxSqli.a(IfxSqli.java:2615)
at com.informix.jdbc.IfxSqli.executeOpenDatabase(IfxSqli.java:1800)
at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1327)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:254)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
at com.dresdnerkw.sds.mistral.generic.HibernateUtil.<clinit>(HibernateUtil.java:15)
at com.dresdnerkw.sds.mistral.generic.EventManager.testDynamicModels(EventManager.java:41)
at com.dresdnerkw.sds.mistral.generic.EventManager.main(EventManager.java:17)


What about that? Is that ok?

Regards,
Helmet


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