jboss简单问题
<!-- Copyright (c) 2002 by ObjectLearn. All Rights Reserved. -->
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import='java.sql.*' %>
<%@ page import='javax.sql.*' %>
<%@ page import='javax.naming.*' %>
<html>
<head>
<title>Welcome</title>
</head>
<body>
<%
ResultSet rs = null;
Statement stmt = null;
Connection conn = null;
try{
Context initCtx = new InitialContext();
//这里和tomcat不一样,不需要java:comp/env
DataSource ds = (DataSource)initCtx.lookup("java:/OracleDS");
conn = ds.getConnection();
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select username,password from usermanager";
rs = stmt.executeQuery(sql); //这句有问题,假如换成insert into usermanager values s_usermanager.nextVal,'aa','bb','1') 是可以执行的
%>
<table>
<%
while(rs.next())
{
%>
<tr>
<td><%=rs.getString("username")+" "+rs.getString("password")%></td>
</tr>
<%
} // end of while
%>
</table>
</body>
</html>
<%
} // end of try
catch(Exception e){
System.out.println("出错啦");
}
finally{
rs.close();
stmt.close();
conn.close();
}
%>
谢谢!!!马上结分