Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.jsp.dbutil
Class DBBean

    java.lang.Object
      |
      +--oracle.jsp.dbutil.DBBean

public class DBBean
extends java.lang.Object
implements JspScopeListener

A very simple bean that provides access to the database and execute queries (only, not DML or DDL).

Bean Properties that can be set and retrieved :

- User - user name for connection
- Password password for connection
- URL URL for database connection

  Constructor Summary
  `DBBean()` Default Constructor

  Method Summary
  `void` | `close()` Close the database connection and any opened cursors.
  `void` | `connect()` Establish a database connection with the given user name, password and URL.
  `java.lang.String` | `getPassword()` Get the password for this data access bean.
  `java.lang.String` | `getResultAsHTMLTable(java.lang.String sql)` Execute the Sql and return the result as a HTM Table.
  `java.lang.String` | `getResultAsXMLString(java.lang.String sql)` Execute the Sql and return the result as a XML String
  `java.lang.String` | `getURL()` Get the URL of the datasource to which connections are made.
  `java.lang.String` | `getUser()` Get the user name for this data access bean.
  `void` | `outOfScope(JspScopeEvent ae)` Invoked when a JSP scope that this object is attached to is ending.
  `void` | `setPassword(java.lang.String password)` Set the password with which connections have to be obtained.
  `void` | `setURL(java.lang.String url)` Set the URL of the datasource to which connection have to be obtained.
  `void` | `setUser(java.lang.String user)` Set the user name with which connections have to be obtained.

  Methods inherited from class java.lang.Object
  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  Constructor Detail

  ### DBBean

      public DBBean()

    Default Constructor

  Method Detail

  ### setUser

      public void setUser(java.lang.String user)

    Set the user name with which connections have to be obtained.

    Parameters:
      `user` - Username to be set.

  ### getUser

      public java.lang.String getUser()

    Get the user name for this data access bean. Returns null if not set.
    Returns:
      user name for this data access bean.

  ### setPassword

      public void setPassword(java.lang.String password)

    Set the password with which connections have to be obtained.

    Parameters:
      `password` - Passoword to be set.

  ### getPassword

      public java.lang.String getPassword()

    Get the password for this data access bean. Returns null if not set.

    Returns:
      password for this data access bean.

  ### setURL

      public void setURL(java.lang.String url)

    Set the URL of the datasource to which connection have to be obtained.

    Parameters:
      `url` - URL to be set.

  ### getURL

      public java.lang.String getURL()

    Get the URL of the datasource to which connections are made. Returns null if not set.

    Returns:
      URL for this data access bean.

  ### connect

      public void connect()
                   throws java.sql.SQLException

    Establish a database connection with the given user name, password and URL.

    Throws:
      java.sql.SQLException - if a database-access error occurs.

  ### close

      public void close()
                 throws java.sql.SQLException

    Close the database connection and any opened cursors. Also, frees up all the resources consumed by this connection.

    Throws:
      java.sql.SQLException - if a database-access error occurs.

  ### getResultAsXMLString

      public java.lang.String getResultAsXMLString(java.lang.String sql)
                                            throws java.sql.SQLException

    Execute the Sql and return the result as a XML String
    Parameters:
      `sql` - Sql String to be executed
    Returns:
      Result as a XML String.
    Throws:
      java.sql.SQLException - if cursor execution fails.

  ### getResultAsHTMLTable

      public java.lang.String getResultAsHTMLTable(java.lang.String sql)
                                            throws java.sql.SQLException

    Execute the Sql and return the result as a HTM Table.
    Parameters:
      `sql` - Sql String to be executed
    Returns:
      Result as a HTML table.
    Throws:
      java.sql.SQLException - if cursor execution fails.

  ### outOfScope

      public void outOfScope(JspScopeEvent ae)

    Description copied from interface: JspScopeListener
    Invoked when a JSP scope that this object is attached to is ending.
    Specified by:
      outOfScope in interface JspScopeListener

  Class | Tree | Deprecated | Index | Help

  PREV CLASS NEXT CLASS | FRAMES NO FRAMES
  SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD