} rs.close(); stmt.close(); conn.close(); out.print("我的测试结束");
}
catch(Exception ex){
out.print("出现例外,信息是:"+ex.getMessage());
ex.printStackTrace();
}
%>
</head>
<body>
</body>
</html>
================================================================================================= testDSsqlserver.jsp文件 <%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*"%>
<%@ page import="javax.naming.*"%>
<%@ page session="false" %>
<html>
<head>
<title></title>
<%
out.print("我的测试开始"+"<br/>");
DataSource ds = null;
try{
InitialContext ctx=new InitialContext();
ds=(DataSource)ctx.lookup("java:comp/env/jdbc/sqlserver");
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] 下一页
|