锘??xml version="1.0" encoding="utf-8" standalone="yes"?>在线成人动漫,国产日韩欧美在线看,日韩三区在线 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) {};
}
}
}
} ]]>
主站蜘蛛池模板:
泸西县 |
龙门县 |
邛崃市 |
朝阳市 |
凯里市 |
蒲江县 |
天祝 |
繁峙县 |
巴彦淖尔市 |
新乐市 |
富阳市 |
江山市 |
都昌县 |
舞钢市 |
安溪县 |
商河县 |
珲春市 |
湖南省 |
宣汉县 |
平原县 |
永吉县 |
黔东 |
镇安县 |
宕昌县 |
汉川市 |
双辽市 |
甘孜县 |
乐至县 |
霍州市 |
荔波县 |
静安区 |
贵定县 |
河西区 |
洞口县 |
施秉县 |
石嘴山市 |
曲沃县 |
抚远县 |
金山区 |
云霄县 |
政和县 |