|
Oracle Application Server Containers for J2EE Support for JavaServer Pages API Reference 10g Release 2 (10.1.2) B14015-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.jsp.dbutil.ConnBean
A Bean to open a database connection. Can enable statement caching and set properties like Row Prefetch and Execute Update Batch Size. Mechanism to create all kinds of statements is also provided.
Bean Properties that can be set and retrieved :
Field Summary | |
protected static int |
DEFAULT_BATCH_SIZE |
protected static int |
DEFAULT_PREFETCH_SIZE |
protected int |
m_batchSize |
protected boolean |
m_commitOnClose |
protected java.sql.Connection |
m_conn |
protected javax.naming.InitialContext |
m_context |
protected javax.sql.DataSource |
m_datasource |
protected java.lang.String |
m_location |
protected java.lang.String |
m_password |
protected int |
m_preFetch |
protected boolean |
m_registered |
protected boolean |
m_resetAutoCommit |
protected int |
m_scSize |
protected java.lang.String |
m_url |
protected java.lang.String |
m_user |
Constructor Summary | |
ConnBean() |
Method Summary | |
void |
close() Close the database connection and any opened cursors. |
void |
connect() Establish a database connection with the user name, password and URL set before. |
java.lang.String |
getCommitOnClose() |
java.sql.Connection |
getConnection() Get the underlying connection object. |
CursorBean |
getCursorBean(int stype, java.lang.String sql) Creates a cursor and returns a CursorBean. |
java.lang.String |
getDataSource() Get the datasource location from which connections will be obtained. |
int |
getExecuteBatch() Get the execute batch size for this connection bean. |
java.lang.String |
getPassword() Get the password for this connection bean. |
int |
getPreFetch() Get the Row prefetch size for this connection bean. |
int |
getStmtCacheSize() Get the statement cache size set for this connection bean. |
java.lang.String |
getURL() Get the URL for this connection bean. |
java.lang.String |
getUser() Get the user name for this connection bean. |
boolean |
isConnectionClosed() |
void |
outOfScope(JspScopeEvent ae) Invoked when a JSP scope that this object is attached to is ending. |
void |
setCommitOnClose(java.lang.String commitOnClose) |
void |
setConnection(java.sql.Connection conn) |
void |
setDataSource(java.lang.String location) Set the datasource location from which connections will be obtained. |
void |
setExecuteBatch(int bsize) Set the Execute Batch Size for DMLs. |
void |
setPassword(java.lang.String password) Set the password with which connections have to be obtained. |
void |
setPreFetch(int prefSize) Set the Row prefetch size for the rows returned for queries. |
void |
setStmtCacheSize(int scsize) Enable and set the statement cache size. |
void |
setURL(java.lang.String url) Set the URL from which connections have to be obtained. |
void |
setUser(java.lang.String user) Set the user name with which connections have to be obtained. |
void |
valueBound(javax.servlet.http.HttpSessionBindingEvent event) |
void |
valueUnbound(javax.servlet.http.HttpSessionBindingEvent event) |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected transient java.sql.Connection m_conn
protected java.lang.String m_user
protected java.lang.String m_password
protected java.lang.String m_url
protected int m_scSize
protected java.lang.String m_location
protected javax.sql.DataSource m_datasource
protected transient javax.naming.InitialContext m_context
protected boolean m_commitOnClose
protected boolean m_resetAutoCommit
protected boolean m_registered
protected static int DEFAULT_PREFETCH_SIZE
protected static int DEFAULT_BATCH_SIZE
protected int m_preFetch
protected int m_batchSize
Constructor Detail |
public ConnBean()
Method Detail |
public void setDataSource(java.lang.String location)
location
- string name of the datasource location.public java.lang.String getDataSource()
public void setUser(java.lang.String user)
user
- Username to be set.public java.lang.String getUser()
public void setPassword(java.lang.String password)
password
- Passowrd to be set.public java.lang.String getPassword()
public void setURL(java.lang.String url)
url
- URL to be set.public java.lang.String getURL()
public void connect() throws java.sql.SQLException
java.sql.SQLException
- if a database-access error occurs.public void close() throws java.sql.SQLException
java.sql.SQLException
- if a database-access error occurs.public java.sql.Connection getConnection()
public CursorBean getCursorBean(int stype, java.lang.String sql) throws java.sql.SQLException
stype
- Statement Type. Possible values are
sql
- Sql string to be executedjava.sql.SQLException
- if cursor creation fails.public void setPreFetch(int prefSize)
prefSize
- prefetch sizepublic int getPreFetch()
Returns 10 (default) if not set.
public void setExecuteBatch(int bsize)
bsize
- Execute Batch Sizepublic int getExecuteBatch()
Returns 1 (default) if not set.
public void setStmtCacheSize(int scsize) throws java.sql.SQLException
scsize
- Statement Cache Sizejava.sql.SQLException
- An error occurred while enabling caching.public int getStmtCacheSize()
public void setCommitOnClose(java.lang.String commitOnClose) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public java.lang.String getCommitOnClose()
public boolean isConnectionClosed()
public void outOfScope(JspScopeEvent ae)
JspScopeListener
outOfScope
in interface JspScopeListener
public void setConnection(java.sql.Connection conn)
public void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
valueBound
in interface javax.servlet.http.HttpSessionBindingListener
public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
valueUnbound
in interface javax.servlet.http.HttpSessionBindingListener
|
Oracle Application Server Containers for J2EE Support for JavaServer Pages API Reference 10g Release 2 (10.1.2) B14015-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |