public final class GenericDataSource extends Object implements DataSource
| Modifier and Type | Class and Description |
|---|---|
static class |
GenericDataSource.ConnectionProxy
Interesting trick to make things compile in both java 1.5 and 1.6
|
| Constructor and Description |
|---|
GenericDataSource(MMBase mmbase) |
GenericDataSource(MMBase mmbase,
File dataDir)
Constructs a datasource for accessing the database belonging to the given MMBase module.
|
| Modifier and Type | Method and Description |
|---|---|
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) |
<T> T |
unwrap(Class<T> iface) |
GenericDataSource(MMBase mmbase, File dataDir) throws StorageInaccessibleException
mmbase - the MMBase instanceA - Datadir (as a string ending in a /) which may be used in some URL's (most noticably those of HSQLDB). Can be null if not used.StorageInaccessibleException - if the JDBC module used in creating the datasource is inaccessibleGenericDataSource(MMBase mmbase) throws StorageInaccessibleException
StorageInaccessibleExceptionpublic Connection getConnection() throws SQLException
getConnection in interface DataSourceSQLExceptionpublic Connection getDirectConnection() throws SQLException
SQLExceptionpublic Connection getConnection(String userName, String password) throws SQLException
getConnection in interface DataSourceSQLExceptionpublic int getLoginTimeout()
getLoginTimeout in interface CommonDataSourcepublic Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger in interface CommonDataSourceSQLFeatureNotSupportedExceptionpublic 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 WrapperMMBase 1.9-SNAPSHOT - ${javadoctimestamp}