SOS!jsp+oracle测试程式,
classpath:D:\Sun\AppServer\jdk\lib\dt.jar;D:\Sun\AppServer\jdk\lib\tools.jar;D:\oracle\ora92\jdbc\lib\classes12.jar
//testoracle.jsp
<%@page contentType="text/html;charset=gb2312"%>
<%@page language="java" %>
<%
import java.util.*;
import java.sql.*;
import javax.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
import javax.naming.*;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String url="jdbc:oracle:thin:@ibm-2373-7wh:1521:ibm";
String user="scott";
String password="dingding";
Connection conn=DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from test";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
your no_id: <%=rs.getString(1)%>
your subject:<%=rs.getString(2)%>
<%}%>
<% out.print("connect to oracle is successed");%>
<% rs.close();
stmt.close();
conn.close();
%>
出错信息:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
No Java compiler was found to compile the generated source for the JSP.
This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK
to the common/lib directory of the Tomcat server, followed by a Tomcat restart.
If using an alternate Java compiler, please check its installation and access path.
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:87)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:311)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:421)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:402)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:262)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:263)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:210)
javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:246)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
note The full stack trace of the root cause is available in the Sun-Java-System/Application-Server-PE-8.0 logs.