try
{
   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
}
catch(ClassNotFoundException e)
{System.out.println("");}
把你的程序都放在try里比较好,调试也会变得方便的!