title: How to display oracle (10g) query results in JSP?
body: <p>I am trying to make a simple JSP snippet to perform queries on an oracle database and display results. Query can be anything like select, delete, alter, update, etc. I need help with making a general code to display query results and errors.</p>
  
  <p>Here is what I have coded so far:</p>
  
  <pre><code>&lt;%@ page language="java" import="java.sql.*" %&gt;
  &lt;%@page import="oracle.jdbc.driver.*" %&gt;
  &lt;%@page import="oracle.sql.*;" %&gt;
  
  &lt;%
  
  Connection conn = null; 
  Statement stmt = null; 
  ResultSet rset = null; 
  
  try {
      DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
      conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.22:1521:orcl",
                                         "test", "testpass");
      stmt = conn.createStatement();
  
      String que = request.getParameter("q");
      rset = stmt.executeQuery (que);
  
  } catch (SQLException e) { 
      out.println("&lt;P&gt; SQL error: &lt;PRE&gt; " + e + " &lt;/PRE&gt; &lt;/P&gt;\n");
  } finally {
      if (rset!= null) rset.close(); 
      if (stmt!= null) stmt.close();
      if (conn!= null) conn.close();
  }
  
  %&gt;
  </code></pre>
  
  <p>My questions are:</p>
  
  <ol>
  <li>How can I automatically display all columns and rows when I execute a query like "select * from emp".</li>
  <li>How to check if a delete/update query has worked correctly or not.</li>
  <li>How to view and alter oracle triggers using JSP.</li>
  </ol>