star (wrong namr)
 这里错了

解决方案 »

  1.   

    下次記得把代碼貼上﹗是不是 static ?
      

  2.   

    Connection conn = DriverManager.getConnection(
                            "jdbc:microsoft:sqlserver://" + url, user, password);
                    conn.setCatalog(db);
      

  3.   

    应该是没找到driver类文件吧,查一下classpath设置如果是找到了,然后判断Connection 是否为空很简单:if(conn != null)
      System.out.println("connection is not null");
    else
      System.out.println("connection is null");