$B$O$8$a$^$7$F!#B?ED$H?=$7$^$9!#(B<br><br>S2 + S2Dao + SQL Server 2000 $B$G%H%i%s%6%/%7%g%s=hM}$K:$$C$F$$$^$9!#(B<br>$B2r7h:v$,$"$j$^$7$?$i$465<x$*4j$$$$$?$7$^$9!#(B<br><br>$B4D6-$O(B<br>s2-2.3.10<br>s2dao-1.0.35<br>SQL Server 2000<br>SQL Server$B$N(BJDBC$B%I%i%$%P$O!"(B<br>Microsoft SQL Server 2005 JDBC Driver$B!J(Bsqljdbc.jar$B!K(BVersion
1.0<br><a href="http://msdn.microsoft.com/data/ref/jdbc/">http://msdn.microsoft.com/data/ref/jdbc/</a><br>$B$r;HMQ$7$F$$$^$9!#(B<br><br>$B>e5-4D6-$K$F!"(B<br>Seasar$B$N%H%i%s%6%/%7%g%s!J(Bj2ee.requiredTx$B!K$r$&$^$/E,MQ$G$-$^$;$s$G$7$?!#(B<br><br>$BFbMF$H$7$F$O!"%F%9%HE*$KF1$8%F!<%V%k$KO"B3$GF1$8%G!<%?$rA^F~$7$F(B
<br><br>PRIMARY KEY $B0cH?(B $B"*(B $B%m!<%k%P%C%/(B $B"*(B $B%G!<%?;D$i$J$$(B<br><br>$B$H$$$&$h$&$J$b$N$G!"(B<br>$B%m%0>e$O!V%H%i%s%6%/%7%g%s$r%m!<%k%P%C%/$7$^$7$?!W$H=P$k$N$G$9$,!"(B<br>DB$B>e$K$O%G!<%?$,;D$C$F$7$^$$$^$9!#(B<br><br>$B%3!<%I$O0J2<$N$h$&$K$J$C$F$*$j$^$9!#(B<br><br>//////////////////////////////////////////////////<br><br>@S2Dao(bean=
User.class)<br>public interface UserDao {<br> <br> int insert(User user);<br> int update(User user);<br> int delete(User user);<br> List<User> getAll();<br> List<User> getUser(User user);<br>
}<br><br>public interface TransactTestClient {<br> <br> void add();<br><br>}<br><br>public class TransactTestClientImpl implements TransactTestClient {<br> <br> private UserDao userDao;<br> <br> public TransactTestClientImpl(UserDao userDao) {
<br> this.userDao = userDao;<br> }<br> <br> public void add() {<br> User user = new User();<br> user.setName("testName");<br> user.setPassword("testPass");<br>
user.setFullname("testFullName");<br> userDao.insert(user);<br> <br> // $B!z(B $B"-$3$3$G=EJ#H/@8(B $B",$3$l(B(1$B7oL\(B)$B$,%m!<%k%P%C%/$5$l$k$h$&$K$7$?$$(B $B!z(B<br> userDao.insert(user);<br><br> }<br><br>}<br><br>public class TransactTestMain {
<br> <br> private static String PATH = "tranClient.dicon";<br> <br> public static void main(String[] args) {<br> <br> S2Container container = S2ContainerFactory.create(PATH);<br>
container.init();<br> try {<br> TransactTestClient cl = <br> (TransactTestClient) container.getComponent(TransactTestClient.class);<br> cl.add();<br> } finally {<br>
container.destroy();<br> }<br> }<br><br>}<br><br>/// tranClient.dicon /////////////////////////////<br><br><?xml version="1.0" encoding="UTF-8"?><br><!DOCTYPE components PUBLIC "-//SEASAR//DTD S2Container
2.3//EN"<br> "<a href="http://www.seasar.org/dtd/components23.dtd">http://www.seasar.org/dtd/components23.dtd</a>"><br><components><br> <include path="tranDao.dicon"/><br> <include path="
j2ee.dicon"/><br> <component class="XXX.TransactTestClientImpl"><br> <arg>UserDao</arg><br> <aspect>j2ee.requiredTx</aspect><br> </component><br></components>
<br><br>/// tranDao.dicon ////////////////////////////////<br><br><?xml version="1.0" encoding="UTF-8"?><br><!DOCTYPE components PUBLIC "-//SEASAR//DTD S2Container 2.3//EN"<br> "
<a href="http://www.seasar.org/dtd/components23.dtd">http://www.seasar.org/dtd/components23.dtd</a>"><br><components><br> <include path="dao.dicon"/><br> <component name="UserDao" class="
XXX.UserDao"><br> <aspect>dao.interceptor</aspect><br> </component><br></components><br><br>/// $B%G!<%?%Y!<%9@_Dj!JH4?h!K(B /////////////////////<br><br><component name="xaDataSource"
<br> class="org.seasar.extension.dbcp.impl.XADataSourceImpl"><br> <property name="driverClassName"><br> "com.microsoft.sqlserver.jdbc.SQLServerDriver"<br> </property>
<br> <property name="URL"><br> "jdbc:sqlserver://IP:Port;DatabaseName=DbName;SelectMethod=cursor"<br> </property><br> <property name="user">"xxx"</property>
<br> <property name="password">"xxx"</property><br></component><br><br><component name="connectionPool"<br> class="org.seasar.extension.dbcp.impl.ConnectionPoolImpl
"><br> <property name="timeout">600</property><br> <property name="maxPoolSize">3</property><br> <property name="allowLocalTx">true</property>
<br> <destroyMethod name="close"/><br></component><br><br><component name="dataSource"<br> class="org.seasar.extension.dbcp.impl.DataSourceImpl"/><br><br>/// $B%m%0(B /////////////////////////////////////////
<br><br>[main] $B%H%i%s%6%/%7%g%s$r3+;O$7$^$7$?(B<br>[main] $BJ*M}E*$J%3%M%/%7%g%s$r<hF@$7$^$7$?(B<br>[main] $BO@M}E*$J%3%M%/%7%g%s$r<hF@$7$^$7$?(B<br>[main] $BO@M}E*$J%3%M%/%7%g%s$rJD$8$^$7$?(B<br>[main] $BO@M}E*$J%3%M%/%7%g%s$r<hF@$7$^$7$?(B<br>[main] INSERT INTO USERS (password, fullname, name) VALUES ('testPass', 'testFullName', 'testName')
<br>[main] $BO@M}E*$J%3%M%/%7%g%s$rJD$8$^$7$?(B<br>[main] $BO@M}E*$J%3%M%/%7%g%s$r<hF@$7$^$7$?(B<br>[main] INSERT INTO USERS (password, fullname, name) VALUES ('testPass', 'testFullName', 'testName')<br>[main] $BO@M}E*$J%3%M%/%7%g%s$rJD$8$^$7$?(B<br>[main] $B%H%i%s%6%/%7%g%s$r%m!<%k%P%C%/$7$^$7$?(B<br>[main] $BJ*M}E*$J%3%M%/%7%g%s$rJD$8$^$7$?(B
<br><br>//////////////////////////////////////////////////<br><br>$B2?$+@_Dj$,B-$j$J$$!&4V0c$C$F$$$kEy$"$j$^$9$G$7$g$&$+!)(B<br><br>$B%"%I%P%$%9!"$h$m$7$/$*4j$$$$$?$7$^$9!#(B<br>