|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.huihoo.jfox.system.ComponentSupport
org.huihoo.jfox.datasource.PoolDataSource
| Field Summary | |
protected SimpleConnectionPool |
pool
|
| Fields inherited from class org.huihoo.jfox.system.ComponentSupport |
logger, name, proxyInstance, sequence, state |
| Constructor Summary | |
PoolDataSource()
Default constructor used by JNDI to get a new Instance without any parameters. |
|
PoolDataSource(java.lang.String dbDriver,
java.lang.String dbURL,
java.lang.String user,
java.lang.String password)
Constructor specify database connection parameters to generate a valid and usable datasource. |
|
| Method Summary | |
protected void |
doDestroy()
do actually destory action |
protected void |
doInit()
do actually create action |
java.sql.Connection |
getConnection()
Get usable connection from datasource |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
Get connection by specific user name and password, the connection is not pooled by Connection Pool |
java.lang.String |
getDbDriver()
|
java.lang.String |
getDbURL()
|
int |
getLoginTimeout()
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database. |
java.io.PrintWriter |
getLogWriter()
Get logger writer |
java.lang.Object |
getObjectInstance(java.lang.Object obj,
javax.naming.Name name,
javax.naming.Context nameCtx,
java.util.Hashtable environment)
Method that inherited from ObjectFactory. |
java.lang.String |
getPassword()
|
javax.naming.Reference |
getReference()
Method that inherited from Referenceable. |
java.lang.String |
getUser()
|
void |
setDbDriver(java.lang.String dbDriver)
|
void |
setDbURL(java.lang.String dbURL)
|
void |
setLoginTimeout(int seconds)
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. |
void |
setLogWriter(java.io.PrintWriter out)
Sets the log writer for this DataSource
object to the given java.io.PrintWriter object.
|
void |
setPassword(java.lang.String password)
|
void |
setUser(java.lang.String user)
|
| Methods inherited from class org.huihoo.jfox.system.ComponentSupport |
destroy, getLogger, getName, getState, init, parseName, setLogger, setName |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected SimpleConnectionPool pool
| Constructor Detail |
public PoolDataSource()
public PoolDataSource(java.lang.String dbDriver,
java.lang.String dbURL,
java.lang.String user,
java.lang.String password)
throws java.lang.Exception
dbDriver - database class name according your dabasedbURL - database url used to access databaseuser - valid database userpassword - // corresponding database password
java.lang.Exception - any exception who cares?| Method Detail |
public java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLException
public java.sql.Connection getConnection(java.lang.String username,
java.lang.String password)
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourceusername - password -
java.sql.SQLException
public java.io.PrintWriter getLogWriter()
throws java.sql.SQLException
getLogWriter in interface javax.sql.DataSourcejava.sql.SQLExceptionDataSource.setLogWriter(java.io.PrintWriter)
public void setLogWriter(java.io.PrintWriter out)
throws java.sql.SQLException
javax.sql.DataSourceSets the log writer for this DataSource
object to the given java.io.PrintWriter object.
The log writer is a character output stream to which all logging
and tracing messages for this data source will be
printed. This includes messages printed by the methods of this
object, messages printed by methods of other objects manufactured
by this object, and so on. Messages printed to a data source-
specific log writer are not printed to the log writer associated
with the java.sql.Drivermanager class. When a
DataSource object is created the log writer is
initially null; in other words, the default is for logging to be
disabled.
setLogWriter in interface javax.sql.DataSourceout -
java.sql.SQLExceptionDataSource.getLogWriter()
public void setLoginTimeout(int seconds)
throws java.sql.SQLException
javax.sql.DataSourceSets the maximum time in seconds that this data source will wait
while attempting to connect to a database. A value of zero
specifies that the timeout is the default system timeout
if there is one; otherwise, it specifies that there is no timeout.
When a DataSource object is created, the login timeout is
initially zero.
setLoginTimeout in interface javax.sql.DataSourceseconds -
java.sql.SQLExceptionDataSource.getLoginTimeout()
public int getLoginTimeout()
throws java.sql.SQLException
javax.sql.DataSourceDataSource object is created, the login timeout is
initially zero.
getLoginTimeout in interface javax.sql.DataSourcejava.sql.SQLExceptionDataSource.setLoginTimeout(int)
public javax.naming.Reference getReference()
throws javax.naming.NamingException
getReference in interface javax.naming.Referenceablejavax.naming.NamingException
public java.lang.Object getObjectInstance(java.lang.Object obj,
javax.naming.Name name,
javax.naming.Context nameCtx,
java.util.Hashtable environment)
throws java.lang.Exception
getObjectInstance in interface javax.naming.spi.ObjectFactoryobj - name - nameCtx - environment -
java.lang.ExceptionNamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable),
NamingManager.getURLContext(java.lang.String, java.util.Hashtable)public java.lang.String getDbDriver()
public void setDbDriver(java.lang.String dbDriver)
public java.lang.String getDbURL()
public void setDbURL(java.lang.String dbURL)
public java.lang.String getUser()
public void setUser(java.lang.String user)
public java.lang.String getPassword()
public void setPassword(java.lang.String password)
protected void doInit()
throws java.lang.Exception
ComponentSupport
doInit in class ComponentSupportjava.lang.Exception
protected void doDestroy()
throws java.lang.Exception
ComponentSupport
doDestroy in class ComponentSupportjava.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||