锘??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美午夜在线视频,伊人久久大香线蕉综合网站,久久最新资源网http://www.aygfsteel.com/huanat/category/13041.htmlcome here!zh-cnThu, 01 Mar 2007 15:36:53 GMTThu, 01 Mar 2007 15:36:53 GMT60Jsp榪炴帴Mysql鏁版嵁搴?甯﹁繛鎺ユ睜) http://www.aygfsteel.com/huanat/archive/2006/07/14/58130.htmlhuanathuanatFri, 14 Jul 2006 03:26:00 GMThttp://www.aygfsteel.com/huanat/archive/2006/07/14/58130.htmlhttp://www.aygfsteel.com/huanat/comments/58130.htmlhttp://www.aygfsteel.com/huanat/archive/2006/07/14/58130.html#Feedback0http://www.aygfsteel.com/huanat/comments/commentRss/58130.htmlhttp://www.aygfsteel.com/huanat/services/trackbacks/58130.html
Property
Value
jdbc/mysql

鍦╟onf/server.xml涓緗涓嬶細

聽聽聽聽聽聽聽 <Context
聽聽聽聽聽聽聽聽聽聽聽 docBase="D:/myjsp"
聽聽聽聽聽聽聽聽聽聽聽 path="/myjsp">
聽聽聽聽聽聽聽聽聽 <ResourceLink
聽聽聽聽聽聽聽聽聽聽聽 global="jdbc/mysql"
聽聽聽聽聽聽聽聽聽聽聽 name="jdbc/mysql"
聽聽聽聽聽聽聽聽聽聽聽 type="javax.sql.DataSourcer"/>
聽聽聽聽聽聽聽 </Context>

:::::::::鎺ョ潃鍙互浣跨敤浜?:::::::

<%@ page contentType="text/html; charset=GBK" language="java"聽 errorPage="" %>
<%@ page session="false"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*"%>
<%@ page import="javax.naming.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>鏃犳爣棰樻枃妗?lt;/title>
</head>

<body>
<%
/** statment搴旂敤瀹炰緥
Connection conn=null;
Statement sm=null;
ResultSet rs=null;
try
{
聽聽 InitialContext ctx=new InitialContext();
聽聽 DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/mysql");
聽聽 conn=ds.getConnection();
聽聽 sm=conn.createStatement();
聽聽 rs=sm.executeQuery("select * from go");聽聽
聽聽 while(rs.next())
聽聽 {
聽聽聽聽聽 out.println(rs.getString(2)+"....."+rs.getInt("id")+"</br>");
聽聽聽 }
}catch(Exception e){
聽聽 e.printStackTrace();
}finally{
聽if(sm!=null)
聽{
聽聽sm.close();
聽}聽
聽if(conn!=null){
聽聽conn.close();
聽}
}
*/
/**preparestatement搴旂敤瀹炰緥
InitialContext ctx=new InitialContext();
DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/mysql");
Connection conn=ds.getConnection();
PreparedStatement psm=conn.prepareStatement("insert into go(name,sex) values(?,?)");
psm.setString(1,"鍗庡摜");
psm.setString(2,"鑻遍泟");
psm.executeUpdate();
psm.close();
conn.close();
out.println("鏇存柊鎴愬姛");

InitialContext ctx=new InitialContext();
DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/mysql");
Connection conn=ds.getConnection();
PreparedStatement psm=conn.prepareStatement("update go set name=? where id=?");
psm.setString(1,"澶╀嬌");
psm.setInt(2,2);
psm.executeUpdate();
out.println("鏇存柊鎴愬姛!");
psm.close();
conn.close();
*/
InitialContext ctx=new InitialContext();
DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/mysql");
Connection conn=ds.getConnection();
Statement sm=conn.createStatement();
ResultSet rs=sm.executeQuery("select * from go");
while(rs.next())
{
聽out.println(rs.getString(1)+"..."+rs.getString(2)+"..."+"</br>");
}
sm.close();
rs.close();
conn.close();
%>
</body>
</html>



huanat 2006-07-14 11:26 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 峨眉山市| 江源县| 鹤山市| 黔南| 内丘县| 吉木乃县| 宜昌市| 和硕县| 达州市| 东台市| 康乐县| 固安县| 双城市| 钦州市| 普兰县| 拜城县| 平陆县| 荥阳市| 大竹县| 聂拉木县| 贡嘎县| 日喀则市| 巴东县| 当阳市| 铜山县| 沿河| 盐津县| 台山市| 左权县| 镇安县| 乐业县| 平和县| 西贡区| 会东县| 江门市| 山阳县| 昌黎县| 长垣县| 阳信县| 共和县| 张北县|