Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Connection auto commit - No begin?

Reply
Thread Tools

Connection auto commit - No begin?

 
 
=?ISO-8859-1?Q?Thomas_Gagn=E9?=
Guest
Posts: n/a
 
      11-19-2003
In Sybase, if I want multiple statements to be part of a transaction I
can nestle them between BEGIN TRAN/COMMIT TRAN statements. reading
about JDBC's Connection objects I understand how auto commit works. But
I'm confused about the absense of a beginTran(). I suppose if
AutoCommit(false) then there's an assumed BEGIN at the start of my
statements that remains opened until I send either commit() or rollback()?

--
..tom
remove email address' dashes for replies
opensource middleware at <http://isectd.sourceforge.net>
http://gagne.homedns.org

 
Reply With Quote
 
 
 
 
John C. Bollinger
Guest
Posts: n/a
 
      11-19-2003
Thomas Gagné wrote:

> In Sybase, if I want multiple statements to be part of a transaction I
> can nestle them between BEGIN TRAN/COMMIT TRAN statements. reading
> about JDBC's Connection objects I understand how auto commit works. But
> I'm confused about the absense of a beginTran(). I suppose if
> AutoCommit(false) then there's an assumed BEGIN at the start of my
> statements that remains opened until I send either commit() or rollback()?


The JDBC driver should handle the DBMS-side details of beginning and
ending transactions, transparently to you. Basically, yes, if you
setAutoCommit(false) on your connection, then you should expect a new
transaction to be started when the first statement is executed on that
connection after opening the connection or committing or rolling back a
transaction. The same transaction will remain open, as far as JDBC is
concerned, until you either commit() or rollback(), and all statements
executed on that connection will be part of it. If the DBMS and JDBC
run into a conflict with respect to transaction boundaries then you
should expect to receive an SQLException. If you want multiple
concurrent transactions you must have multiple connections.


John Bollinger


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to turn off auto commit in rake 0.8.7 zoras Ruby 2 10-21-2010 04:05 PM
Auto Shipping Auto Shipping Scheduling:car moving auto transport linkswanted ASP .Net 0 02-16-2008 02:40 AM
ODBC - Turning auto commit off mvr ASP General 0 09-09-2005 02:31 PM



Advertisments