jsp运行出错请各位指点一下
================================================================
运行环境:Tomcat 6.0+mssql2000(sp3补丁,jdbc sp3两个都打上了)
================================================================
DataConn.java源码如下
=========================================================================
package coms;
import java.sql.*;
public class DataConn
{
private Connection conn=null;
private Statement stmt=null;
public DataConn()
{
try
{
String strDriver= "com.microsoft.jdbc.sqlserver.SQLServerDriver ";
Class.forName(strDriver);
}
catch(
ClassNotFoundException cnfe)
{
System.out.print( "数据驱动不存在: "+cnfe.getMessage());
}
try
{
String strConn= "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=chatMessage ";
String strUserID= "chat2007 ";
String strPwd= "chat2007123 ";
conn=DriverManager.getConnection(strConn,strUserID,strPwd);
stmt=conn.createStatement();
}
catch(
SQLException se)
{
System.out.print( "创建数据失败: "+se.getMessage());
}
}
//关闭数据链接
public void CloseConn()
{
try
{
if(conn.isClosed()!=true)
{
stmt.close();
conn.close();
}
}
catch(SQLException se)
{
System.out.print( "关闭数据链接失败: "+se.getMessage());
}
}
//查询操作
public ResultSet execSelect(String strSql)
{
ResultSet rs=null;
try
{
rs=stmt.executeQuery(strSql);
}
catch(SQLException se)
{
System.out.print( "查询操作失败: "+se.getMessage());
}
return rs;
}
}
===================================================================
list.jsp源码如下
=====================================================================
<%@ page contentType= "text/html; charset=gb2312 " language= "java "
errorPage= " " %>
<%@ page import= "java.sql.* "%>
<%@ page import= "java.util.* " %>
<%@ page import= "coms.DataConn "%>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 无标题文档 </title>
</head>
<body>
<%
DataConn dc=new DataConn();
try
{
String strSql= "select * from logTa ";
ResultSet rs=null;
rs=dc.execSelect(strSql);
while(rs.next())
{
out.print(rs.getString(2)+ " <br> ");
}
rs.close();
}
catch(Exception ex)
{
out.print( "出错了 ");
}
dc.CloseConn();
%>
</body>
</html>
===============================================================
运行过后出错: