Play中的Informix XA驱动程序!框架应用

时间:2011-01-04 10:32:24

标签: hibernate informix playframework

我正在尝试使用Play的Informix数据库!框架应用。我是Informix的新手。

我的Windows机器上安装了Informix 11.70,我正在运行Play 1.1。

在游戏中!您可以像这样指定数据库连接:

db.url=jdbc:informix-sqli://localhost:9088/mydatabase:INFORMIXSERVER=ol_informix1170
db.driver=com.informix.jdbc.IfxDriver
db.user=informix
db.pass=password

但是在运行我的Play时我遇到了异常!应用程式:

An unexpected error occured caused by exception PersistenceException: org.hibernate.TransactionException: JDBC begin failed:

play.exceptions.UnexpectedException: Unexpected Error
        at play.Invoker$Invocation.onException(Invoker.java:153)
        at play.Invoker$Invocation.run(Invoker.java:195)
        at Invocation.HTTP Request(Play!)
Caused by: javax.persistence.PersistenceException: org.hibernate.TransactionException: JDBC begin failed:
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1235)
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1168)
        at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1245)
        at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:63)
        at play.db.jpa.JPAPlugin.startTx(JPAPlugin.java:321)
        at play.db.jpa.JPAPlugin.beforeInvocation(JPAPlugin.java:289)
        at play.Invoker$Invocation.before(Invoker.java:116)
        at play.Invoker$Invocation.run(Invoker.java:186)
        ... 1 more
Caused by: org.hibernate.TransactionException: JDBC begin failed:
        at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:96)
        at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1463)
        at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:60)
        ... 5 more
Caused by: java.sql.SQLException: Transactions not supported
        at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:413)
        at com.informix.jdbc.IfxSqliConnect.setAutoCommit(IfxSqliConnect.java:2189)
        at com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)
        at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:91)
        ... 7 more

我认为因为我试图在事务中执行我的查询但是我没有指定XA驱动程序。只有com.informix.jdbc.IfxDriver。但是我似乎无法找到用于Informix的XA驱动程序。

如何配置我的游戏!申请使用Informix?

感谢

1 个答案:

答案 0 :(得分:3)

问题是您没有正确配置Informix。您的数据库未配置为事务日志记录,因此,它不支持事务。不是真正的Hibernate也不是Play!问题。因此,请使用以下内容重新创建表:

CREATE DATABASE mydatabase WITH LOG;

http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.ddi.doc/ddi73.htm