Subject:
D12 Listings Changes
From:
DBlake@cmp.com
Date:
Wed, 6 Oct 2004 09:32:44 -0600
To:
JErickson@ddj.com




Only the Lead (shas/bonn) had changes:

Listing One
Connection conn = getConnection();  // from a java.sql.DriverManager
conn.setAutoCommit(false); // by default each SQL statement is a transaction
                           // setting autocommit to false let the programmer
                           // define the transaction boundaries

int nbrows = 0;            // nb rows impacted by the update statements
Statement stmt = conn.createStatement();

String fromchecking =
            "UPDATE checking SET balance = balance - 10000 WHERE name = bob";
nbrows = stmt.executeUpdate(fromchecking);
                                     // implicitly starts the transaction
String tosavings =
            "UPDATE savings SET balance = balance + 10000 WHERE name = bob";
nbrows = stmt.executeUpdate(fromchecking);
stmt.close();

conn.commit();          // ends the transaction
conn.close();



DDJ



__________________________________________________________________________________________

Any views or opinions are solely those of the author and do not necessarily
represent those of CMP Media.

The information transmitted is intended only for the person or entity to which
it is addressed and may contain confidential and/or privileged material.  If you
are not the intended recipient of this message please do not read, copy, use or
disclose this communication and notify the sender immediately.  It should be
noted that any review, retransmission, dissemination or other use of, or taking
action or reliance upon, this information by persons or entities other than the
intended recipient is prohibited.
__________________________________________________________________________________________


