JDBC驱动三个文件放到jdk/jre/lib/ext里

解决方案 »

  1.   

    各位JSP高手,能不能把你的的设置给我看一下。我装了一个j2sdk1.4.2   Microsoft SQL Server 2000 Driver for JDBC   Tomcat 5.0   SQLSERVER2000   我觉得好像不差东西了,上面的大侠说了我已经照他做了,但是还有点问题,有没有什么能检测他成功的代码?上面说到了CLASSPATH  TOMCAT_HOME  JAVA_HOME加了,还在PATH到面加了一个C:\j2sdk1.4.2;.;C:\j2sdk1.4.2\bin 以前后面就有%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN 这些内容,我就是搞不清楚问题出在什么地方?
    <%@ page import="java.lang.*, java.io.*, java.sql.*, java.util.*" contentType="text/html;charset=gb2312" %>
      <html>
      <body>
      <% Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
       String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs";
       //pubs 为你的数据库的
       String user="sa";
       String password="admin";
       Connection conn= DriverManager.getConnection(url,user,password);
       Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
       String sql="select job_id,job_desc from jobs";
       ResultSet rs=stmt.executeQuery(sql);
       while(rs.next()) { %>
        您的第一个字段内容为:<%=rs.getString(1)%><br>
        您的第二个字段内容为:<%=rs.getString(2)%><br>
      <% } %>
      <% out.print("数据库操作成功,恭喜你"); %>
      <% rs.close();
       stmt.close();
       conn.close();
      %>
      </body>
      </html> 
     这是我从网上找的代码?他后面就这样报错?请问问题出在什么地方HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: /text.jsp(1,4) Invalid directive
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:90)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:506)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539)
    org.apache.jasper.compiler.Parser.parse(Parser.java:126)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.
    --------------------------------------------------------------------------------Apache Tomcat/5.0.27
      

  2.   

    http://blog.sina.com.cn/myblog/article/article_show.php?nid=44b8fb7701000002
      

  3.   

    打了,SQLserver2000也能运行,但是就是不知道为什么,它总是报错!