<description>SqlServer Datasource example</description> <res-ref-name>jdbc/SqlServerDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
3.测试
编写jsp文件:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import=" javax.naming.*"%>
<html>
<body>
<%
Context ctx = new InitialContext();
Connection conn=null;
ctx = new InitialContext();
DataSource ds =(DataSource)ctx.lookup(" java:comp/env/jdbc/test");
conn = ds.getConnection();
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
|