1 24 25 package org.objectweb.cjdbc.scenario.horizontal; 26 27 import java.sql.Connection ; 28 import java.sql.Statement ; 29 30 import org.objectweb.cjdbc.driver.ControllerInfo; 31 import org.objectweb.cjdbc.scenario.templates.HorizontalTemplate; 32 33 39 public class DistributedTransactionScenario extends HorizontalTemplate 40 { 41 42 47 public void testDistributedTransaction() throws Exception 48 { 49 Connection con = getCJDBCConnection(new ControllerInfo[]{ 50 new ControllerInfo("localhost", 25322), 51 new ControllerInfo("localhost", 25323)}); 52 con.setReadOnly(false); 53 con.setAutoCommit(false); 54 Statement stmt = con.createStatement(); 55 stmt.executeUpdate("update product set name='horizontalTest'"); 56 con.commit(); 57 con.setAutoCommit(true); 58 con.close(); 59 } 60 } | Popular Tags |