import java.sql.*;
public class Test{
  public Test(){}
  public static void main(String args[]){
    try{
      Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); 
      Connection conn=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;User=sa;Password=null;DatabaseName=maxwell");
Statement stmt=conn.createStatement(); 
String sql="select * from  employee"; 
ResultSet rs = stmt.executeQuery(sql);
 while(rs.next()) { 
  System.out.println("TestName:"+rs.getString("name"));
  }
  rs.close();
  stmt.close();
  conn.close();
} catch(Exception ex) { System.err.println(ex.getMessage()); }
}} 
原代码