<%@ page import="java.sql.* , oracle.jsp.dbutil.*" %> <% String connStr=request.getParameter("connStr"); if (connStr==null) { connStr=(String)session.getValue("connStr"); } else { session.putValue("connStr",connStr); } if (connStr==null) { %> <% } %> Connection Bean Demo JSP

Hello <%= (request.getRemoteUser() != null? ", " + request.getRemoteUser() : "") %> ! I'm Connection Bean Demo JSP.


I'm using connection and query beans and I'm querying EMP names and salaries from the EMP table in the schema SCOTT.

<% try { // Make the Connection cbean.connect(); String sql = "SELECT ename, sal FROM scott.emp ORDER BY ename"; // get a Cursor Bean CursorBean cb = cbean.getCursorBean (CursorBean.PREP_STMT, sql); out.println(cb.getResultAsHTMLTable()); // Close the cursor bean cb.close(); // Close the Bean to close the connection cbean.close(); } catch (SQLException e) { out.println("

" + "There was an error doing the query:"); out.println ("

" + e + "
\n

"); } %>