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

java.lang.Objectorg.mmbase.storage.implementation.database.GenericDataSource
public final class GenericDataSource
This class functions as a DataSource wrapper around the JDBC Module. It is intended for use when MMBase runs outside an application server, or when the server does not (or poorly) support pooled DataSources. It can also be used by older systems that use the JDBC Module and do not want to change their configuration. Note that the JDBC Module will likely be faced out as a module at some point in the future, with code and supporting classes to be moved to this class instead.
| Nested Class Summary | |
|---|---|
static class |
GenericDataSource.ConnectionProxy
Interesting trick to make things compile in both java 1.5 and 1.6 |
| Constructor Summary | |
|---|---|
GenericDataSource(MMBase mmbase)
|
|
GenericDataSource(MMBase mmbase,
File dataDir)
Constructs a DataSource for accessing the database belonging to the given MMBase module. |
|
| Method Summary | ||
|---|---|---|
Connection |
getConnection()
|
|
Connection |
getConnection(String userName,
String password)
|
|
Connection |
getDirectConnection()
|
|
int |
getLoginTimeout()
|
|
PrintWriter |
getLogWriter()
|
|
Logger |
getParentLogger()
|
|
boolean |
isWrapperFor(Class<?> iface)
|
|
protected String |
makeUrl()
Makes URL which can be used to produce a Conncetion. |
|
void |
setLoginTimeout(int seconds)
Note: currently this code does not actually change the timeout. |
|
void |
setLogWriter(PrintWriter out)
|
|
|
unwrap(Class<T> iface)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
GenericDataSource(MMBase mmbase,
File dataDir)
throws StorageInaccessibleException
mmbase - the MMBase instanceA - data directory (as a string ending in a /) which may be used in some URL's (most noticeably those of HSQLDB). Can be null if not used.
StorageInaccessibleException - if the JDBC module used in creating the DataSource is inaccessible
GenericDataSource(MMBase mmbase)
throws StorageInaccessibleException
StorageInaccessibleException| Method Detail |
|---|
public Connection getConnection()
throws SQLException
getConnection in interface DataSourceSQLException
public Connection getDirectConnection()
throws SQLException
SQLException
public Connection getConnection(String userName,
String password)
throws SQLException
getConnection in interface DataSourceSQLExceptionpublic int getLoginTimeout()
getLoginTimeout in interface CommonDataSourcepublic PrintWriter getLogWriter()
getLogWriter in interface CommonDataSourcepublic void setLoginTimeout(int seconds)
setLoginTimeout in interface CommonDataSourcepublic void setLogWriter(PrintWriter out)
setLogWriter in interface CommonDataSourceprotected String makeUrl()
public boolean isWrapperFor(Class<?> iface)
isWrapperFor in interface Wrapperpublic <T> T unwrap(Class<T> iface)
unwrap in interface Wrapperpublic Logger getParentLogger()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||