Jsp connect oracle 9i there do not know how to solve the problems.

  Abstract: jsp connect oracle 9i there do not know how to solve the problems. 


  Jsp oracle unsuccessful connections to ask how do: 


<head>
  <% @ Page language = "java" contentType = "text / html; GBK charset ="%> 
  <% @ Page import = "java.sql .*"%> 

  </ Head> 
<body>
<%
  Class.forName ( "oracle.jdbc.driver.OracleDriver"). NewInstance (); ** ** Note here the problem 
  String url = "jdbc: oracle: thin: @ PC113: 1521: LGTDB" / / database is not in the plane 
  File: LGTDB; 
  String user = "system"; 
  String password = "sys123"; 
  Connection conn = DriverManager.getConnection (url, user, password); 
  Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); 
  String sql = "select * from CTXSYS.MYTEST"; 
  ResultSet rs = stmt.executeQuery (sql); 
  While (rs.next ()) 
  ( 
%>
  <% = Rs.getString (1)%> 


<%
  ) 
%>
  <% Out.print ( "database operations successful, congratulate you ");%> 
<%
  Rs.close (); 
  Stmt.close (); 
  Conn.close (); 
%>
  </ Body> 


  An error occurred at line: 31 in the jsp file: / index.jsp 
  Generated servlet error: 
  D: / Apache / Tomcat / work / Catalina / localhost / myapp / org / apache / jsp / index_jsp.java: 80: It is not a statement 
  File: LGTDB; 
^
  A mistake 
  Org.apache.jasper.compiler.DefaultErrorHandler.javacError (DefaultErrorHandler.java: 84) 
  Org.apache.jasper.compiler.ErrorDispatcher.javacError (ErrorDispatcher.java: 332) 
  Org.apache.jasper.compiler.Compiler.generateClass (Compiler.java: 437) 
  Org.apache.jasper.compiler.Compiler.compile (Compiler.java: 497) 
  Org.apache.jasper.compiler.Compiler.compile (Compiler.java: 476) 
  Org.apache.jasper.compiler.Compiler.compile (Compiler.java: 464) 
  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) 


  Ask …… 

  I have already put classes12.jar respectively: 

  D: / java / jdk / lib, D: / Apache / Tomcat / webapps / myapp / WEB-INF / lib, D: / Apache / Tomcat / common / lib Below to ask how successful can be done! 

  A distress call 




  The problem has been resolved to personal access points. 
  Class.forName ( "oracle.jdbc.driver.OracleDriver"). NewInstance (); 
  String url = "jdbc: oracle: thin: @ PC113: 1521: LGTDB"; 
  String user = "system"; 
  String password = "sys123"; 
  Connection conn = DriverManager.getConnection (url, user, password); 
  Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); 
  String sql = "select * from MYTEST"; 
  ResultSet rs = stmt.executeQuery (sql); 
  While (rs.next ()) 
  ( 
%>
  <% = Rs.getString (2)%> 


<%
  ) 
%>
  <% Out.print ( "database operations successful, congratulate you ");%> 
<%
  Rs.close (); 
  Stmt.close (); 
  Conn.close (); 
%>



  Access to the top 


  ↑ Back 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Tags:

Releated Java Articles

Comments

Leave a Reply