错误代码:WLTC0032W ibatis作为持久层,websphere 报告连接没有提交错误,问题的解决以及产生的原因
2006-11-30 19:27
627 查看
As I said, iBATIS is trying to avoid extra commits when they are not
needed. So iBATIS sets auto commit to false, and then will commit the
transaction if an insert, update, or delete has been performed. This works
in many environments, but not WebSphere.
This is precisely why there are options on the transaction managers -
because all the different environments work a little differently.
I added some information about this in the developer guide a few weeks ago.
Jeff Butler
On 7/7/06, Cornel Antohi <cantohi@kepler-rominfo.com> wrote:
>
> Hi Jeff,
>
> In order to avoid extra commits, shouldn't iBatis do:
>
> connection.setAutoCommit(*true*); ?
>
> But iBatis always make connection.setAutoCommit(*false*) which means that
> we have to perform a connection.commit() at the end ... I do not
> understand why iBatis is ALWAYS making:
> connection.setAutoCommit(false);
>
> What is the reason?
>
> Thank you,
> Cornel
>
> ----- Original Message -----
> *From:* Jeff Butler <jeffgbutler@gmail.com>
> *To:* user-java@ibatis.apache.org
> *Sent:* Friday, July 07, 2006 3:09 PM
> *Subject:* Re: autoCommit
>
>
> iBATIS is trying to avoid extra commits when they are not needed, but that
> doesn't play well with WebSphere. This is a "feature" of WebSphere. See
> here:
>
>
> http://opensource.atlassian.com/confluence/oss/display/IBATIS/Environment+Specific+Information >
> Other transaction managers are a little looser in their implementations.
>
> In other words - that's just the way it is.
>
> Jeff Butler
>
>
> On 7/7/06, Cornel Antohi <cantohi@kepler-rominfo.com> wrote:
> >
> > Hi,
> >
> > I have found in com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction
> > class, init method, the following lines of code:
> >
> > // AutoCommit
> > *if* (connection .getAutoCommit()) {
> > connection.setAutoCommit(*false* ); }
> >
> > I do not understand why should it be set to "false" by default, even I
> > am running simple SELECT statements !
> >
> > Using Websphere as application server, I am receiving the following
> > warning messages after each database call:
> > [7/7/06 13:40:41:111 EEST] 00000026 LocalTranCoor W WLTC0032W: One or
> > more local transaction resources were rolled back during the cleanup of a
> > LocalTransactionContainment.
> >
> > and sometimes errors like Websphere cannot cleanup the connection
> > because it seems to be in a transaction !!!
> >
> > One solution found on Internet is to setup in sql-map-config:
> > <
> > transactionManager type="JDBC" *commitRequired="true" *>
> > and iBatis will perform a commit() at the end (see SqlMapConfigParser
> > and TransactionManager classes):
> >
> > txManager.setForceCommit(
> > "true".equals(attributes.getProperty( "commitRequired"))); ...
> > if
> > (session.isCommitRequired() || forceCommit ) { trans.commit();
> > session.setCommitRequired(
> > *false*); }
> >
> > My question is: why should I use "commitRequired=true" even if I am
> > executing a simple SELECT statement ? I feel that this "commitRequired=true"
> > is a workaround to a problem generated by wrong initialization of the
> > JdbcTransaction!
> >
> > Thank you,
> > Cornel
> >
>
>
最有用的一句话的意思是:在ibatis 的sql-map-config.xml中配置好下面这句话,强制提交:
<transactionManager type="JDBC" commitRequired="true" >
needed. So iBATIS sets auto commit to false, and then will commit the
transaction if an insert, update, or delete has been performed. This works
in many environments, but not WebSphere.
This is precisely why there are options on the transaction managers -
because all the different environments work a little differently.
I added some information about this in the developer guide a few weeks ago.
Jeff Butler
On 7/7/06, Cornel Antohi <cantohi@kepler-rominfo.com> wrote:
>
> Hi Jeff,
>
> In order to avoid extra commits, shouldn't iBatis do:
>
> connection.setAutoCommit(*true*); ?
>
> But iBatis always make connection.setAutoCommit(*false*) which means that
> we have to perform a connection.commit() at the end ... I do not
> understand why iBatis is ALWAYS making:
> connection.setAutoCommit(false);
>
> What is the reason?
>
> Thank you,
> Cornel
>
> ----- Original Message -----
> *From:* Jeff Butler <jeffgbutler@gmail.com>
> *To:* user-java@ibatis.apache.org
> *Sent:* Friday, July 07, 2006 3:09 PM
> *Subject:* Re: autoCommit
>
>
> iBATIS is trying to avoid extra commits when they are not needed, but that
> doesn't play well with WebSphere. This is a "feature" of WebSphere. See
> here:
>
>
> http://opensource.atlassian.com/confluence/oss/display/IBATIS/Environment+Specific+Information >
> Other transaction managers are a little looser in their implementations.
>
> In other words - that's just the way it is.
>
> Jeff Butler
>
>
> On 7/7/06, Cornel Antohi <cantohi@kepler-rominfo.com> wrote:
> >
> > Hi,
> >
> > I have found in com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction
> > class, init method, the following lines of code:
> >
> > // AutoCommit
> > *if* (connection .getAutoCommit()) {
> > connection.setAutoCommit(*false* ); }
> >
> > I do not understand why should it be set to "false" by default, even I
> > am running simple SELECT statements !
> >
> > Using Websphere as application server, I am receiving the following
> > warning messages after each database call:
> > [7/7/06 13:40:41:111 EEST] 00000026 LocalTranCoor W WLTC0032W: One or
> > more local transaction resources were rolled back during the cleanup of a
> > LocalTransactionContainment.
> >
> > and sometimes errors like Websphere cannot cleanup the connection
> > because it seems to be in a transaction !!!
> >
> > One solution found on Internet is to setup in sql-map-config:
> > <
> > transactionManager type="JDBC" *commitRequired="true" *>
> > and iBatis will perform a commit() at the end (see SqlMapConfigParser
> > and TransactionManager classes):
> >
> > txManager.setForceCommit(
> > "true".equals(attributes.getProperty( "commitRequired"))); ...
> > if
> > (session.isCommitRequired() || forceCommit ) { trans.commit();
> > session.setCommitRequired(
> > *false*); }
> >
> > My question is: why should I use "commitRequired=true" even if I am
> > executing a simple SELECT statement ? I feel that this "commitRequired=true"
> > is a workaround to a problem generated by wrong initialization of the
> > JdbcTransaction!
> >
> > Thank you,
> > Cornel
> >
>
>
最有用的一句话的意思是:在ibatis 的sql-map-config.xml中配置好下面这句话,强制提交:
<transactionManager type="JDBC" commitRequired="true" >
相关文章推荐
- 使用Ibatis生成的代码日期中没有时分秒的问题原因和解决办法
- C# Maximum request length exceeded. 产生错误的原因,以及解决方法.
- 没有网络连接时程序崩溃问题以及动态加载图片问题已解决
- Entity Framework4.3安装以及错误(基础连接已经关闭:未能为SSL/TLS……)问题解决!
- Office 2010 激活提示网络连接错误,错误代码0*80072F8F(及其他问题)的解决办法
- 使用redis集群+tomcat缓存共享下session丢失问题产生原因以及解决
- C# Maximum request length exceeded. 产生错误的原因,以及解决方法.
- Entity Framework安装以及错误(基础连接已经关闭:未能为SSL/TLS……)问题解决!
- win8系统宽带连接提示错误628代码的故障原因及解决方法
- C# Maximum request length exceeded. 产生错误的原因,以及解决方法.
- 多线程-线程安全问题的产生原因分析以及同步代码块的方式解决线程安全问题
- [转]WebService 中Maximum request length exceeded. 产生错误的原因,以及解决方法.
- GitHUb 代码提交遇到的问题以及解决办法
- mysql问题解决(MySQL服务无法启动,服务没有报告任何错误的解决办法)
- C# Maximum request length exceeded. 产生错误的原因,以及解决方法.
- 请大家看一下一个c语言中的链表问题,下面的代码是有错误的!!请大家说出错误的原因,以及修改的方法!!!
- HeadFirst 组合模式+迭代器错误原因以及解决代码
- 解决YII提交POST表单出现400错误,以及ajax post请求时出现400问题
- win8出现蓝屏错误代码0x000007B原因以及解决方法
- 解决Project Professional 2003连接Project Server 2003服务器"您没有权限以查看此页"错误信息的问题