String driverClass = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String connectUrl = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=ejb";
Class.forName(driverClass);
Connection conn = DriverManager.getConnection(connectUrl,"sa","");
注意:还有下载三个microsoft的驱动类