|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.db.SimpleDataSource
DataConnectionPool is an implementation of the javax.sql.DataSource.
Normally you would get an instance of the DataConnectionPool using
DBConnectionPool.getDataSource(String)
Typical Usage:
javax.sql.DataSource dataSource = DBConnectionPool.getDataSource("default");
java.sql.Connection connection = dataSource.getConnection();
...
connection.close();
DBConnectionPool,
DBConnection| Constructor Summary | |
SimpleDataSource(DBConnectionPool newPoolInstance)
Wrapping constructor. |
|
| Method Summary | |
Connection |
getConnection()
Retreive a java.sql.Connection for this data source. |
Connection |
getConnection(String username,
String password)
[Unused] Normally would retrieve a connection with the given username and password. |
protected DBConnectionPool |
getConnectionPool()
Helper method to retrieve the instance of the connectionPool we're attached to |
int |
getLoginTimeout()
Retrieve the login timeout [unimplemented] |
PrintWriter |
getLogWriter()
Retrieve the current logWriter. |
void |
setLoginTimeout(int seconds)
Set the login timeout. |
void |
setLogWriter(PrintWriter out)
Sets the log writer and thus turns on logging |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SimpleDataSource(DBConnectionPool newPoolInstance)
newPoolInstance - the instance of the DBConnectionPool| Method Detail |
protected DBConnectionPool getConnectionPool()
public Connection getConnection()
throws SQLException
getConnection in interface javax.sql.DataSourceSQLException - upon error getting the connection
public Connection getConnection(String username,
String password)
throws SQLException
Normally would retrieve a connection with the given username and password. However,
that is not possible with the Expresso's DBConnectionPool which manages the default
username and password as given in the configuration file. So this implementation
logs a warning about this method and falls back to getConnection()
getConnection in interface javax.sql.DataSourceusername - the user name for the connectionpassword - the password for the connection
SQLException - upon connection errorgetConnection()
public PrintWriter getLogWriter()
throws SQLException
getLogWriter in interface javax.sql.DataSourceSQLException - upon error
public void setLogWriter(PrintWriter out)
throws SQLException
setLogWriter in interface javax.sql.DataSourceout - the new print writer to log getConnection() calls to.
SQLException - upon error
public void setLoginTimeout(int seconds)
throws SQLException
setLoginTimeout in interface javax.sql.DataSourceseconds - the number of seconds to wait before logins timeout
SQLException - upon error
public int getLoginTimeout()
throws SQLException
getLoginTimeout in interface javax.sql.DataSourceSQLException - upon error
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||