日期:2014-05-18  浏览次数:20636 次

再看:jsp连接 oracle 的问题,眼都看晕了
昨天找了一天原因,眼都快看晕了..还是不行...请高手们帮人分析一下..查了以前的贴,都试了还是不行..


<%@   page   contentType= "text/html;charset=gb2312 "%>  
<%@   page   import= "java.sql.* "%>  
<html>  
<body>  
<%


Class.forName( "oracle.jdbc.driver.OracleDriver ").newInstance();        
String   url= "jdbc:oracle:thin:@localhost:1521:orcl ";  
//orcl为你的数据库的SID  
String   user= "sqlfun ";  
String   password= "puppy ";  
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())   {%>        
您的第一个字段内容为: <%=rs.getString( "userid ")%>        
  <br>
<%
}


%>  


</body>  
</html>


type   Exception   report

message  

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

javax.servlet.ServletException:   oracle.jdbc.driver.OracleDriver
at   org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:498)
at   org.apache.jsp.love_jsp._jspService(love_jsp.java:99)
at   org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:92)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:162)
at   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
at   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at   org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at   org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at   org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
at   org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at   org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at   org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at   org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
at   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at   org.apache.catalina.core.S