锘??xml version="1.0" encoding="utf-8" standalone="yes"?>懂色av影视一区二区三区,亚洲视频在线一区二区,久久超碰97中文字幕http://www.aygfsteel.com/huanat/come here!zh-cnThu, 19 Jun 2025 15:51:59 GMTThu, 19 Jun 2025 15:51:59 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 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 宁德市| 阿坝| 长治县| 晋州市| 光泽县| 佛学| 乳山市| 巴彦淖尔市| 赤峰市| 墨脱县| 绍兴县| 南郑县| 柯坪县| 阿尔山市| 沅江市| 腾冲县| 昌宁县| 肇庆市| 民县| 邹平县| 东山县| 资溪县| 辽宁省| 射阳县| 棋牌| 江口县| 永顺县| 山东| 巫溪县| 安阳市| 浪卡子县| 常熟市| 天全县| 政和县| 慈利县| 泾阳县| 台北市| 绍兴市| 永州市| 沅江市| 东源县|