java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][DBNETLIB]一般性网络错误。请检查网络文档。
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at ConDB.<init>(ConDB.java:16)//******
at agentcopepanel.<init>(agentcopepanel.java:231)//******
at TreeListener.valueChanged(TreeListener.java:25)//******
at javax.swing.JTree.fireValueChanged(Unknown Source)
at javax.swing.JTree$TreeSelectionRedirector.valueChanged(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(Unknown Source)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(Unknown Source)
at javax.swing.JTree.setSelectionPath(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelectionImpl(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)就是加注示的三行有错,

解决方案 »

  1.   

    ConDB.javaimport java.sql.*;import sun.jdbc.odbc.JdbcOdbcDriver;public class ConDB { private Connection conn;
    private PreparedStatement pstmt;
    private Statement stmt;
    private ResultSet rs;
    public ConDB() throws Exception {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String url = "jdbc:odbc:MainCall";
    String user = "sa";
    String pwd = "";
    conn = DriverManager.getConnection(url,user,pwd);//******
    }
    public PreparedStatement getpstmt(String sql,int i,int j)throws Exception {
    pstmt = conn.prepareStatement(sql,i,j);
    return pstmt;
    }
    public ResultSet getpstmt(String sql)throws Exception {
    pstmt = conn.prepareStatement(sql);
    rs =pstmt.executeQuery();
    return rs;
    }
    public ResultSet getstmt(String sql) throws Exception{
    stmt = conn.createStatement();
    rs = stmt.executeQuery(sql);
    return rs;
    }
    // public ResultSet getpstmtrs() throws Exception{
    // ResultSet rs =pstmt.executeQuery();
    // return rs;
    // }
    // public ResultSet getstmtrs(String sql) throws Exception{
    // ResultSet rs =stmt.executeQuery(sql);
    // return rs;
    // }
    }
      

  2.   

    没贴出其它两个文件,太长了就是这个ConDB.java有错不知道怎么解决这个问题系统重做的,SQL重装了,eclipse没重装,数据源也建了,库也导入了,SQL中的安全性也改为SQL Server和window
      

  3.   

    你的包都有吗?
    得装后,JDK还在原来的地方吗?
      

  4.   

    谢谢大家了,我自己搞定了,重装后,jdk要访问网络,我给屏蔽了,我允许它访问网络,就ok了