看看你在ODBC中设了test 这个数据源了吗?

解决方案 »

  1.   

    你不是装了mssql 2000 driver for JDBC吗,怎么还用odbc?到底你是什么意思?
      

  2.   

    public Connection getConnection() throws Exception{
     try{
          Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver" );
          String url="jdbc:microsoft:sqlserver://192.168.0.11:1433;databaseName=test";
          String uid="sa";
          String pwd="1q2w3e";
          this.conn =DriverManager.getConnection(url,uid,pwd);
        }
        catch(SQLException ex){
          conn.close();      System.err.println("连接数据库出错:"+ ex.getMessage());
        }
        return conn;
      }
      

  3.   

    哦,我在ODBC中没设test这个数据源了,现在好了,谢谢大家