JSP连接SQL Server 2000系统配置问题! JDBC驱动三个文件放到jdk/jre/lib/ext里 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 各位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 http://blog.sina.com.cn/myblog/article/article_show.php?nid=44b8fb7701000002 打了,SQLserver2000也能运行,但是就是不知道为什么,它总是报错! 关于用汉字查询的问题 在JSP中如何用滚动条显示结果集合 关于数据录入及导出 关于CLOB的 数据库连接问题 请问有关JSP流量统计,小妹先谢谢各位了!! Java 在Linux的绝对路径写法问题 Post方式,当数据过长时request.getParameterNames()居然得不到其它参数了? iframe的一个小问题? 怎么样在jsp中写一段脚本:实现以下功能呢? 【页面刷新问题】页面每隔一段时间自动刷新一次数据库,因为网速问题,每次刷新的时候都要一短时间才全部打开。为了实现连续性。有没有办 Jsp 找不到Beans 问题,请帮忙解决一下!!!
<%@ 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