!C99Shell v. 1.0 pre-release build #13!

Software: Apache. PHP/5.5.15 

uname -a: Windows NT SVR-DMZ 6.1 build 7600 (Windows Server 2008 R2 Enterprise Edition) i586 

SYSTEM 

Safe-mode: OFF (not secure)

E:\oracle\product\10.2.0\client_2\sqlj\doc\   drwxrwxrwx
Free 4.97 GB of 239.26 GB (2.08%)
Detected drives: [ a ] [ c ] [ d ] [ e ] [ f ]
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     sqlj-conn-beans.html (9.65 KB)      -rw-rw-rw-
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
sqlj datasources

SQLJ-Specific JSP Connection Beans

SQLJ-specific connection beans are available in runtime12ee.jar or runtime12ee.zip.

In OracleJSP, the connection beans support the API getConnection() that returns JDBC connections. Specifically, there are two connection beans in OracleJSP:

oracle.jsp.dbutil.ConnBean,
oracle.jsp.dbutil.ConnCacheBean.
SQLJ-specific connection beans extends the original connection beans with APIs that returns SQLJ connection contexts in OracleJSP applications. Specifically, there are two SQLJ-specific connection beans:

oracle.sqlj.runtime.SqljConnBean,
oracle.sqlj.runtime.SqljConnCacheBean.

Both SQLJ-specific connection beans support a new bean property ContextClass of Type java.lang.Class and the following APIs:

public synchronized void setContextClass(Class contextClass)
public synchronized Class getContextClass()
public synchronized sqlj.runtime.ref.DefaultContext getDefaultContext()
public synchronized sqlj.runtime.ConnectionContext getContext().
The bean property ContextClass indicates type of the connection context returned by getContext() method call. By default, the value of the bean property ContextClass is sqlj.runtime.ref.DefaultContext. The setContextClass() and getContextClass() methods are setter and getter of that bean property.

The getDefaultContext() and getContext() methods are handled differently for SqljConnBean and SqljConnCacheBean. Below, we discuss the handling of the two methods for SqljConnBean and SqljConnCacheBean respectively.
 
 

SqljConnBean
A SqljConnBean instance can issue only one logical JDBC connection. Multiple invocations of the getConnection method will return the same logical JDBC connection. Since a connection context created by a SqljConnBean instance is associated with a logical JDBC connection created by that SqljConnBena instance, the behavior of getDefaultContext and getContext needs to mimic that of the getConnection, i.e., a SqljConnBean instance has only one active connection context.

The getDefaultContext() method returns a DefaultContext instance. The getContext() methods returns a connection context of the type specified by the ContextClass bean property.

The first getDefaultContext() or getContext() method call will create and return a connection context based on the JDBC connection associated with the connection bean. The returned connection context will also be stored in the SqljConnBean instance.

Once a connection context has been created and stored, the behaviour of subsequent getDefaultContext() method calls will depend on the type of the stored connection context. If the stored connection context is a DefaultContext instance, getDefaultContext() will return the stored connection context. If the stored connection context is not a DefaultContext instance,  getDefaultContext() will close the stored connection context, reuse the JDBC connection associated with that stored connection context to create and return a new connection context.

Once a connection context has been created and stored, the behaviour of subsequent getContext() method calls will depend on the type of the stored connection context and the current setting of the ContextClass bean property. If the stored connection context is of the same type as specified by ContextClassgetContext() will return the stored connection context. If the stored connection context is not of the type specified by ContextClass, getContext() will close the stored connection context, reuse the JDBC connection associated with the stored connection context to create and return a new connection context.

A newly created connection context is stored to replace the previously stored connection context.

As mentioned before, at one time, only one active connection context is allowd for a SqljConnBean instance. Closing the logical JDBC connection instantiated by a SqljConnBean instance will force any active connection context in that to SqljConnBean instance be shutdown. Closing a connection context using close() or close(ConnectionContext.CLOSE_CONNECTION) will shutdown the associated JDBC connection, while closing a connection context using close(ConnectionContext.KEEP_CONNECTION) will keep the associated JDBC connection active.

SqljConnCacheBean
Unlike SqljConnBean, SqljConnCacheBean creates and returns a new logical JDBC connection for each invocation of the getConnection method. The getDefaultContext or getContext methods mimic the behavior of getConnection. I.e., Each getDefaultContext or getContext call creates a new connection context.

Closing a logical JDBC connection created by a SqljConnCacheBean instance will shutdown the connection context associated with that JDBC connection. Closing a connection context using close() or close(ConnectionContext.CLOSE_CONNECTION) will shutdown the associated JDBC connection, while closing a connection context using close(ConnectionContext.KEEP_CONNECTION) will keep the associated JDBC connection active.

Example
The following program,  SQLJSelectInto.sqljsp, demonstrates the usage of the usage of SqljConnCacheBean, its ContextClass bean properties, and its getContext() API.
<%@ page language="sqlj"
         import="java.sql.*, oracle.sqlj.runtime.SqljConnCacheBean" %>

<jsp:useBean id="cbean" class="oracle.sqlj.runtime.SqljConnCacheBean" scope="session">
<jsp:setProperty name="cbean" property="User" value="scott"/>
<jsp:setProperty name="cbean" property="Password" value="tiger"/>
<jsp:setProperty name="cbean" property="URL" value="jdbc:oracle:thin:@pdcsun-dev3:1521:view13"/>
<jsp:setProperty name="cbean" property="ContextClass" value="sqlj.runtime.ref.DefaultContext"/>
</jsp:useBean>

<HTML>
<HEAD> <TITLE> The SQLJSelectInto JSP  </TITLE> </HEAD>
<BODY BGCOLOR=white>

<% String empno = request.getParameter("empno");
   if (empno != null) { %>
      <H3> Employee # <%=empno %> Details: </H3>
<%     String ename = null;  double sal = 0.0;  String hireDate = null;
     StringBuffer sb = new StringBuffer();
sqlj.runtime.ref.DefaultContext ctx=null;
    try {
      // Make the Connection
      ctx = (sqlj.runtime.ref.DefaultContext) cbean.getContext();
    } catch (SQLException e) {
    }
     try {
        #sql [ctx] { SELECT ename, sal, TO_CHAR(hiredate, 'DD-MON-YYYY')
                      INTO :ename, :sal, :hireDate
                      FROM scott.emp WHERE UPPER(empno) = UPPER(:empno)
        };
        sb.append("<BLOCKQUOTE><BIG><B><PRE>\n");
        sb.append("Name       : " + ename + "\n");
        sb.append("Salary     : " + sal + "\n");
        sb.append("Date hired : " + hireDate);
        sb.append("</PRE></B></BIG></BLOCKQUOTE>");

     } catch (java.sql.SQLException e) {
         sb.append("<P> SQL error: <PRE> " + e + " </PRE> </P>\n");
     } finally {
         if (ctx!= null) ctx.close();
     }
%>
<H3><%=sb.toString()%></H3>
<%}
%>

<B>Enter an employee number:</B>
<FORM METHOD=get>
<INPUT TYPE="text" NAME="empno" SIZE=10>
<INPUT TYPE="submit" VALUE="Ask Oracle");
</FORM>
</BODY>
</HTML>
<%
%>


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #13 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0312 ]--