You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "Devine, James" <ja...@fmr.com> on 2008/06/09 19:57:11 UTC

AutoCommit Defaulted to true/false?

Hello,
I am using iBatis for data access with a Sybase database.  Our Sybase
database is configured to run in "unchained" mode, which basically means
that autocommit must be set to true.

I am trying to figure out the default behavior of iBatis with respect to
autocommit.  I thought that autocommit was set to false by default.  

However, when I execute this, I am getting back true:
sqlMapClient.getDataSource().getConnection().getAutoCommit();

- I thought that iBatis defaulted autocommit to false.  Is this not the
case?


Thanks,
Jim


RE: AutoCommit Defaulted to true/false?

Posted by "Devine, James" <ja...@fmr.com>.
Thanks Nathan.  I was also looking through this guide.  
 
On page 53, it states:
By default, calling any execute method on SqlMapClient instance (e.g.
queryForObject() or insert()) will
auto-commit or auto-rollback. This means that each call to any execution
method will be a single unit of
work. This is simple indeed, but not ideal if you have a number of
statements that must execute as a single
unit of work (i.e. either succeed or fail as a group). This is where
transactions come into play.
 
I don't currently have a transactionManager defined.  If needed, we will
likely use spring's tx manager.  
 
It sounds like auto-commit is true until you define a transaction
manager.  Do you agree?
 
Thanks,
Jim


  _____  

	From: Nathan Maves [mailto:nathan.maves@gmail.com] 
	Sent: Monday, June 09, 2008 3:52 PM
	To: user-java@ibatis.apache.org
	Subject: Re: AutoCommit Defaulted to true/false?
	
	
	Taken from the Developer Guide located at
http://ibatis.apache.org/javadownloads.cgi
	
	The <transactionManager> element also allows an optional
attribute commitRequired that can be true or
	false. Normally iBATIS will not commit transactions unless an
insert, update, or delete operation has been
	performed. This is true even if you explicitly call the
commitTransaction() method. This behavior
	creates problems in some cases. If you want iBATIS to always
commit transactions, even if no insert, update, or delete operation has
been performed, then set the value of the commitRequired attribute to
true.
	
	
	On Mon, Jun 9, 2008 at 11:57 AM, Devine, James
<ja...@fmr.com> wrote:
	

		Hello, 
		I am using iBatis for data access with a Sybase
database.  Our Sybase database is configured to run in "unchained" mode,
which basically means that autocommit must be set to true.

		I am trying to figure out the default behavior of iBatis
with respect to autocommit.  I thought that autocommit was set to false
by default.  

		However, when I execute this, I am getting back true: 
	
sqlMapClient.getDataSource().getConnection().getAutoCommit(); 

		- I thought that iBatis defaulted autocommit to false.
Is this not the case? 


		Thanks, 
		Jim 



Re: AutoCommit Defaulted to true/false?

Posted by Nathan Maves <na...@gmail.com>.
Taken from the Developer Guide located at
http://ibatis.apache.org/javadownloads.cgi

The <transactionManager> element also allows an optional attribute
commitRequired that can be true or
false. Normally iBATIS will not commit transactions unless an insert,
update, or delete operation has been
performed. This is true even if you explicitly call the commitTransaction()
method. This behavior
creates problems in some cases. If you want iBATIS to always commit
transactions, even if no insert, update, or delete operation has been
performed, then set the value of the commitRequired attribute to true.

On Mon, Jun 9, 2008 at 11:57 AM, Devine, James <ja...@fmr.com> wrote:

>  Hello,
> I am using iBatis for data access with a Sybase database.  Our Sybase
> database is configured to run in "unchained" mode, which basically means
> that autocommit must be set to true.
>
> I am trying to figure out the default behavior of iBatis with respect to
> autocommit.  I thought that autocommit was set to false by default.
>
> However, when I execute this, I am getting back true:
> sqlMapClient.getDataSource().getConnection().getAutoCommit();
>
> - I thought that iBatis defaulted autocommit to false.  Is this not the
> case?
>
> Thanks,
> Jim
>