<body><%
Connection conn=null;
Statement stmt=null;
String driver="com.microsoft.sqlserver.jdbc.sqlserverDriver";
String username="sa";
String password="d2009";
String sql=null;
String url="jdbc:sqlserver://172.20.1.5:1433;DatabaseName=MPL";
try{System.out.print("加载之前");
Class.forName("COM.MICROSOFT.sqlserver.jdbc.SQLSERVERDriver");
System.out.println("connection successful!");
}
catch(ClassNotFoundException e){
System.out.print(e);
}
try{
System.out.print("加载之前");
conn=DriverManager.getConnection(url,username,password);
System.out.println("connection successful!");
}
catch(SQLException ee){
System.out.print(ee);
}
%>
</body>运行之后显示空白

解决方案 »

  1.   

    catch(Exception ee){
    System.out.print(ee);
    }
    改成捕捉 所有异常试试 O(∩_∩)O~
      

  2.   

    你这页面什么都没写 当然就是什么也显示不了
    将System.out.print 直接换成out.print 就能看到效果了
      

  3.   

    <body><%
    Connection conn=null;
    Statement stmt=null;
    String driver="com.microsoft.sqlserver.jdbc.sqlserverDriver";
    String username="sa";
    String password="d2009";
    String sql=null;
    String url="jdbc:sqlserver://172.20.1.5:1433;DatabaseName=MPL";
    try{

       out.print("加载驱动之前<br />");
       Class.forName("COM.MICROSOFT.sqlserver.jdbc.SQLSERVERDriver");
       out.println("load DB driver  successful!");
       out.println("连接之前<br />");
       conn=DriverManager.getConnection(url,username,password);
       out.println("connection successful! <br />");
    }catch(Exception e){
       out.print(e + "<br />");
    }
    %>
    </body>
      

  4.   

     现在又报错了 - - 
    org.apache.jasper.JasperException: An exception occurred processing JSP page /Untitled-1.jsp at line 2626: conn=DriverManager.getConnection(url,username,password);
    求救~~~
      

  5.   

    //conn=DriverManager.getConnection(url,username,password);
    你把这一行注释掉,看看是什么 ,你运行的话,后台应该有报错信息才对啊 ,你把后台报错信息发出来供大家欣赏一下嘛
      

  6.   

    java.lang.UnsupportedOperationException: 此驱动程序不支持 Java Runtime Environment (JRE) 1.6 版。请使用支持 JDBC 4.0 的 sqljdbc4.jar 类库。怎么解决
      

  7.   

    屏蔽了 就可以运行了   后台的错误HTTP Status 500 -type Exception reportmessagedescription The server encountered an internal error () that prevented it from fulfilling this request.exceptionorg.apache.jasper.JasperException: java.lang.UnsupportedOperationException: 此驱动程序不支持 Java Runtime Environment (JRE) 1.6 版。请使用支持 JDBC 4.0 的 sqljdbc4.jar 类库。
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    root causejava.lang.UnsupportedOperationException: 此驱动程序不支持 Java Runtime Environment (JRE) 1.6 版。请使用支持 JDBC 4.0 的 sqljdbc4.jar 类库。
    com.microsoft.sqlserver.jdbc.SQLServerConnection.<init>(SQLServerConnection.java:304)
    com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1011)
    java.sql.DriverManager.getConnection(DriverManager.java:582)
    java.sql.DriverManager.getConnection(DriverManager.java:185)
    org.apache.jsp.Untitled_002d1_jsp._jspService(Untitled_002d1_jsp.java:78)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.33 logs.
      

  8.   

    我新下载的sqljdbc4.0难道还会有问题不成???????????????????????????????????怎么办啊现在 重新下载吗~~~~
      

  9.   

    org.apache.jasper.JasperException: java.lang.UnsupportedOperationException: 此驱动程序不支持 Java Runtime Environment (JRE) 1.6 版。请使用支持 JDBC 4.0 的 sqljdbc4.jar 类库。你的jre不支持啊,别下最新的啊,适合的才是正确的
      

  10.   

    sqljdbc.jar\ com.microsoft.sqlserver.jdbc.SQLServerDriver
      
    Class.forName("COM.MICROSOFT.sqlserver.jdbc.SQLSERVERDriver"); ??
    -->
    Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); 
      

  11.   

    喃无厄尼托佛   终于成功了  真心感谢楼上几位童鞋  我不是搞java的 因为工作原因要弄个网页  第一次弄