锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久国产婷婷国产香蕉,久久久精品区,亚洲国产高清aⅴ视频 http://www.aygfsteel.com/silvernapoleon/archive/2006/09/25/70010.html#71657sunyi sunyi Mon, 25 Sep 2006 02:04:00 GMT http://www.aygfsteel.com/silvernapoleon/archive/2006/09/25/70010.html#71657
u just do a such professional blog
can't understand
huhuhuhuhu
best wishes always
]]> re: 鍝綅鍏勫紵浜嗚В"浜嬪姟" 甯府灝忓紵 涓嶈儨鎰熻阿 http://www.aygfsteel.com/silvernapoleon/archive/2006/08/12/61376.html#63150# # Sat, 12 Aug 2006 03:39:00 GMT http://www.aygfsteel.com/silvernapoleon/archive/2006/08/12/61376.html#63150 try{
/*
*1:璁劇疆鐜銆備負璁塊棶JNDI錛岀ⅶ琛鍒濆鍖栦笂涓嬫枃宸ュ巶銆佹彁渚沀RL銆佹墍闇鐨勭敤鎴峰悕銆佸瘑鐮? *2錛氬叿浣撶粏鑺傦紝鍙互鍙傝冨簲鐢ㄦ湇鍔″櫒鐨勭粰鍑虹殑浜у搧鏂囨。
*3錛氭敞鎰忥紝閲嶇偣鍙傝冩枃妗d腑鏈夊叧JNDI鐨勯儴鍒? */
java.util.Properties env = ...
/*
*2:鑾峰緱JNDI鍒濆涓婁笅鏂? */
Context ctx = new InitialContext(env);
/*
*3:鍊熷姪浜嶫NDI錛屾煡鎵綣TA UserTransaction鎺ュ彛
*閫氬父錛屽鍣ㄩ兘鍥炴睙JTA鏆撮湶鍦ㄢ渏ava:comp/UserTransaction鈥濅綅緗?
*
*/
userTran = (javax.transaction.UserTransaction)
ctx.lookup("java:comp/UserTransaction");
/*
*4:鎵ц浜嬪姟
*/
userTran.begin();
//瀹屾垚涓氬姟鎿嶄綔
userTran.commit();
}
catch(Exception e)
//澶勭悊寮傚父錛屽寘鎷簨鍔″洖婊氱殑澶勭悊銆?
} ]]> re: 鍝綅鍏勫紵浜嗚В"浜嬪姟" 甯府灝忓紵 涓嶈儨鎰熻阿 http://www.aygfsteel.com/silvernapoleon/archive/2006/08/07/61376.html#62224Crespo Crespo Mon, 07 Aug 2006 11:14:00 GMT http://www.aygfsteel.com/silvernapoleon/archive/2006/08/07/61376.html#62224 import javax.transaction.*;
import java.sql.*;
import java.util.*;
import java.io.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
public class JTATest
{
public static void main(String args[])
{
Context ctx=null;
Hashtable ht=new Hashtable();
DataSource ds=null;
Statement stmt=null;
ResultSet rs=null;
Connection myConn = null;
UserTransaction tx = null;
String tablename="student";
String str1="INSERT INTO student VALUES ('01001001','ixucheng', 33)";
String str2="INSERT INTO student VALUES ('01001002','hangsan', 44)";
try
{
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,"t3://localhost:7001");
ctx=new InitialContext(ht);
String str="javax.transaction.UserTransaction";
tx =(UserTransaction)ctx.lookup(str);
tx.begin();
ds = (javax.sql.DataSource)ctx.lookup("TestData");
myConn= ds.getConnection();
stmt = myConn.createStatement();
stmt.executeUpdate (str1);
stmt.executeUpdate (str2);
tx.commit();
System.out.println("Success!");
}
catch (Exception E)
{
try{tx.rollback();}catch(Exception e){}
System.out.println("浜嬪姟鍙戠敓閿欒錛屼簨鍔¤鍙栨秷錛?");
}
finally
{
if (rs != null)
{
try{ rs.close(); } catch (Exception ignore) {};
}
if (stmt != null)
{
try{ stmt.close(); } catch (Exception ignore) {};
}
if (myConn != null)
{
try { myConn.close(); } catch (Exception ignore) {};
}
}
}
} ]]>
主站蜘蛛池模板:
长兴县 |
平湖市 |
利辛县 |
永川市 |
阜平县 |
泰安市 |
海城市 |
乌拉特后旗 |
敖汉旗 |
承德县 |
丹巴县 |
自贡市 |
炎陵县 |
莱西市 |
胶州市 |
石家庄市 |
二连浩特市 |
晋中市 |
儋州市 |
桦川县 |
崇州市 |
西藏 |
泰和县 |
龙陵县 |
怀安县 |
东城区 |
文成县 |
南陵县 |
墨脱县 |
皋兰县 |
札达县 |
高台县 |
新河县 |
长泰县 |
乌海市 |
图木舒克市 |
克拉玛依市 |
浪卡子县 |
开平市 |
望城县 |
桦甸市 |