MS SQL Server sp4补丁打包然后把三个jar文件靠到你的项目里去就可以了

解决方案 »

  1.   

    可以肯定是没有给SQL Server 打补丁
      

  2.   

    打了补丁还是没用,这段错误又是怎么一回事?
    type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception java.lang.NullPointerException
    com.softeem.studentunion.dao.LoginDao.validate(LoginDao.java:26)
    com.softeem.studentunion.servlet.LoginServlet.process(LoginServlet.java:50)
    com.softeem.studentunion.servlet.LoginServlet.doPost(LoginServlet.java:41)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
      

  3.   

    第一次的问题就是驱动补丁的问题,第二次问题需要你把和数据库相关的代码贴出来,很有可能是SQL写错了
      

  4.   

    这个代码是别人写的,当时他写完测试一点问题也没有,给我拿回来就一堆问题,不过在eclipse里面没有报错了就是,相关代码如下:
    package com.softeem.studentunion.dao;import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;public class LoginDao {

    private Connection conn;

    private PreparedStatement ps = null;

    private ResultSet rs = null;

    private final static String SQL_FIND = "select password from login where username=?"; public LoginDao(Connection conn) {
    super();
    this.conn = conn;
    }

    public boolean validate(String username,String password){
    boolean flag = false;
    try {
    ps = conn.prepareStatement(SQL_FIND);
    ps.setString(1, username);
    rs = ps.executeQuery();
    while(rs.next()){
    if(rs.getString(1).equals(password)){
    flag = true;
    break;
    }
    }

    } catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }finally{
    if(conn != null){
    try {
    conn.close();
    } catch (SQLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }
    }
    return flag;
    }}
      

  5.   

    package com.softeem.studentunion.servlet;import java.io.IOException;
    import java.sql.Connection;import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;import com.softeem.studentunion.dao.DataSourceFactory;
    import com.softeem.studentunion.dao.LoginDao;/**
     * Servlet implementation class for Servlet: LoginServlet
     *
     */
     public class LoginServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
       static final long serialVersionUID = 1L;
       
        /* (non-Java-doc)
     * @see javax.servlet.http.HttpServlet#HttpServlet()
     */
    public LoginServlet() {
    super();
    }   

    /* (non-Java-doc)
     * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    process(request,response);
    }  

    /* (non-Java-doc)
     * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    process(request,response);
    }   
    protected void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    String forward = null; 
    String username = request.getParameter("username");
    String password = request.getParameter("password");
    Connection conn = DataSourceFactory.getConnection();
    LoginDao dao = new LoginDao(conn);
    if(dao.validate(username, password)){
    forward = "MemberListServlet";
    }else{
    forward = "failure.jsp";
    }
    RequestDispatcher rd = request.getRequestDispatcher(forward);
    rd.forward(request, response);

    }
      

  6.   

    Debug一下你的代码
    1:检查 Connection conn = DataSourceFactory.getConnection();中conn是否成功
    2:查看 String username = request.getParameter("username");String password = request.getParameter("password");中 username和password是否已经获取
    3:检查 ResultSet rs
    第三步可能不需要检查了,我分析是根本就没拿到Connection,看看你的DataSourceFactory吧
      

  7.   

    [email protected],这也是MSN,或者QQ:1298726
      

  8.   

    邮件已发出,你的QQ要回答问题,MSN我已卸了多年了。。
      

  9.   

    先测测“LoginDao”通不通,判断Connection是否为空,不行就ODBC桥连吧
    如果跳转有问题,就看看路径写对了吗
      

  10.   

    昨天CSDN更新,没给你回复,不过你说的这个问题实在是不好一句两句说清除的了,还是让你的那个朋友看看你的数据库问题出现在哪吧,或者你写个简单的JDBC链接下你的数据库,再有就是使用Eclipes中的DB Browser连接下看看。
      

  11.   

    似乎是因为"conn"的引用为null造成的
      

  12.   


    别用ms的driver
    推荐使用jTDS