新手弱智问题,在线等啊
刚自学JSP,写个连接数据库的实例,老显示不出来。
<%@ page contentType= "text/html;charset=gb2312 " %>
<%@ page import= "java.sql.* " %>
<%
Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ").newInstance();
try{
Connection conn = DriverManager.getConnection( "JDBC:microsoft:sqlserver://localhost:1433;DatabaseName=hanpeirong ", "sa ", "sa ");
Statement stmm = conn.createStatement();
String sql = "select * from JIUQI ";
ResultSet rs = stmm.executeQuery(sql);
while(rs.next())
{%>
<%=rs.getString(1) %>
<%=rs.getString(2) %>
<%=rs.getString(3) %>
<%}
%>
<%
rs.close();
stmm.close();
conn.close();
%>
<%}
catch(
SQLException e)
{
}
%>
大家能帮我看看有什么错误吗?
------解决方案--------------------SQL没装SP4补丁.
所以JSP中无法使用纯JAVA连接.