private static class TempTableDataSourceProvider.DataSourceImpl
extends java.lang.Object
implements javax.sql.DataSource
DataSource
interface, which maintains context-local data for each
private temp-table connection.Modifier and Type | Class and Description |
---|---|
private static class |
TempTableDataSourceProvider.DataSourceImpl.Context
Context-specific data.
|
Modifier and Type | Field and Description |
---|---|
private static ContextLocal<TempTableDataSourceProvider.DataSourceImpl.Context> |
context
Context local variable to hold context-specific data
|
private static java.util.logging.Logger |
LOG
Logger
|
Modifier | Constructor and Description |
---|---|
private |
DataSourceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Intercept close requests to close the physical database connection only when there is no temp-table
which still needs it.
|
java.sql.Connection |
getConnection()
Attempts to establish a connection with the data source of the
_temp database. |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
Attempts to establish a connection with the data source of the
_temp database. |
int |
getLoginTimeout() |
java.io.PrintWriter |
getLogWriter() |
java.util.logging.Logger |
getParentLogger() |
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(java.io.PrintWriter out) |
<T> T |
unwrap(java.lang.Class<T> iface) |
private static final java.util.logging.Logger LOG
private static final ContextLocal<TempTableDataSourceProvider.DataSourceImpl.Context> context
public java.sql.Connection getConnection() throws java.sql.SQLException
_temp
database.
Uses the credentials from the DatabaseManager
configuration.getConnection
in interface javax.sql.DataSource
java.sql.SQLException
- if a database access error occurs.public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
_temp
database.
If credentials are null
, the DatabaseManager
configuration is inspected
for their values.getConnection
in interface javax.sql.DataSource
username
- The database user on whose behalf the connection is made. If null
, the
value is read form @code DatabaseManager}'s configuration.password
- The password of the database user on whose behalf the connection is made. If
null
, the value is read form @code DatabaseManager}'s configuration.java.sql.SQLException
- if a database access error occurs.public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
java.sql.SQLException
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
java.sql.SQLException
public java.io.PrintWriter getLogWriter()
getLogWriter
in interface javax.sql.CommonDataSource
public void setLogWriter(java.io.PrintWriter out)
setLogWriter
in interface javax.sql.CommonDataSource
public void setLoginTimeout(int seconds)
setLoginTimeout
in interface javax.sql.CommonDataSource
public int getLoginTimeout()
getLoginTimeout
in interface javax.sql.CommonDataSource
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
getParentLogger
in interface javax.sql.CommonDataSource
java.sql.SQLFeatureNotSupportedException
public void close() throws java.sql.SQLException
java.sql.SQLException
- if there is an error closing the connection.