Software caused connection abort: socket write error
是不是网络断了 造成你访问网络资源失败了.
网页正常显示,估计是因为你捕获了这个错误----------------------------------------------
   www.coderpub.com

解决方案 »

  1.   

    用try/catch把数据库操作这一段代码,扩起来,不让他显示,或在打印输出异常的前后加入
    <!-- 和--> 以注释的形式打印。
      

  2.   

    1. 这是bean.
    package myweb;public class PhotoInfo {  private String id;
      private String smallIcon;
      private String bigIcon;  public String getId() {
        return id;
      }
      public void setId(String id) {
        this.id = id;
      }
      public String getSmallIcon() {
        return smallIcon;
      }
      public void setSmallIcon(String smallIcon) {
        this.smallIcon = smallIcon;
      }
      public String getBigIcon() {
        return bigIcon;
      }
      public void setBigIcon(String bigIcon) {
        this.bigIcon = bigIcon;
      }
    }2. 这是连接数据库的。package myweb;import java.sql.*;public class DBAccess {
      private String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
      private String url = "jdbc:odbc:photo";
      private Connection conn = null;  public DBAccess() throws ClassNotFoundException, SQLException {
        Class.forName(driver);
        conn = DriverManager.getConnection(url);
      }  public Connection getConnection() {
        return conn;
      }
    }3. 这是操作数据库的,现在不知道是哪里报错?package myweb;import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.util.ArrayList;
    import java.sql.Connection;public class PhotoInfo_2 {  public ArrayList getPhoto(String type) throws SQLException, ClassNotFoundException {
        DBAccess db = new DBAccess();
        Connection conn = db.getConnection();
        Statement sm = conn.createStatement();
        ResultSet resultSet = null;
        String sql = "select * from photo where type = '" + type + "'";
        resultSet = sm.executeQuery(sql);    ArrayList list = new ArrayList();    while (resultSet.next()) {
          PhotoInfo info = new PhotoInfo();
          info.setId(resultSet.getString("id"));
          list.add(info);
        }
        resultSet.close();
        sm.close();
        conn.close();    return list;
      }
    }
      

  3.   

    java.net.SocketException: Software caused connection abort: socket write error。这个应该是socket的问题,一般就是mssql没有打补丁。代码一般很少问题的,不行就换数据库或者数据库的驱动。
      

  4.   

    我先用SQL的数据库,后又用了access的,都一样。如果要打补丁,应打什么样的?
      

  5.   

    DBAccess中的url怎么会没有用户名跟密码的?
      

  6.   

    我后来用的access的数据库,不用用户名和密码的。