|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.teiid.jdbc.WrapperImpl
org.teiid.jdbc.BaseDataSource
public abstract class BaseDataSource
The Teiid JDBC DataSource implementation class of DataSource and
XADataSource.
The DataSource interface follows the JavaBean design pattern,
meaning the implementation class has properties that are accessed with getter methods
and set using setter methods, and where the getter and setter methods follow the JavaBean
naming convention (e.g., getPropertyName() : PropertyType
and setPropertyName(PropertyType) : void).
XADataSource interface is almost identical to the DataSource
interface, but rather than returning Connection instances, there are methods that
return XAConnection instances that can be used with distributed transactions.
| Field Summary | |
|---|---|
static java.lang.String |
APP_NAME
|
static java.lang.String |
DEFAULT_APP_NAME
|
protected static int |
DEFAULT_FETCH_SIZE
|
protected static int |
DEFAULT_LOG_LEVEL
|
protected static java.lang.String |
DEFAULT_PARTIAL_RESULTS_MODE
|
protected static java.lang.String |
DEFAULT_RESULT_SET_CACHE_MODE
|
protected static int |
DEFAULT_TIMEOUT
|
static java.lang.String |
JDBC
|
static java.lang.String |
PASSWORD
|
static java.lang.String |
TXN_WRAP_AUTO
Transaction auto wrap constant - checks if a command requires a transaction and will be automatically wrap it. |
static java.lang.String |
TXN_WRAP_OFF
Transaction auto wrap constant - never wrap a command execution in a transaction and allow multi-source updates to occur outside of a transaction. |
static java.lang.String |
TXN_WRAP_ON
Transaction auto wrap constant - always wrap every non-transactional command execution in a transaction. |
static java.lang.String |
USER_NAME
|
static java.lang.String |
VDB_NAME
|
static java.lang.String |
VDB_VERSION
|
static java.lang.String |
VERSION
|
| Constructor Summary | |
|---|---|
BaseDataSource()
Constructor for MMDataSource. |
|
| Method Summary | |
|---|---|
protected java.util.Properties |
buildProperties(java.lang.String userName,
java.lang.String password)
|
java.lang.String |
getAdditionalProperties()
|
java.lang.String |
getApplicationName()
Returns the name of the application. |
java.lang.String |
getAutoCommitTxn()
Returns the current setting for how connections are created by this DataSource manage transactions for client requests when client applications do not use transactions. |
java.sql.Connection |
getConnection()
Attempt to establish a database connection. |
java.lang.String |
getDatabaseName()
Returns the name of the virtual database on a particular Teiid Server. |
java.lang.String |
getDatabaseVersion()
Returns the databaseVersion. |
java.lang.String |
getDataSourceName()
Returns the logical name for the underlying XADataSource or
ConnectionPoolDataSource;
used only when pooling connections or distributed transactions are implemented. |
java.lang.String |
getDescription()
Returns the description of this data source. |
java.lang.String |
getDisableLocalTxn()
|
int |
getFetchSize()
|
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 the log writer for this data source. |
java.lang.String |
getPartialResultsMode()
|
java.lang.String |
getPassword()
Returns the password. |
javax.sql.PooledConnection |
getPooledConnection()
|
javax.sql.PooledConnection |
getPooledConnection(java.lang.String userName,
java.lang.String password)
|
java.lang.String |
getResultSetCacheMode()
|
java.lang.String |
getShowPlan()
|
java.lang.String |
getTransactionAutoWrap()
Deprecated. |
java.lang.String |
getUser()
Returns the user. |
javax.sql.XAConnection |
getXAConnection()
|
javax.sql.XAConnection |
getXAConnection(java.lang.String userName,
java.lang.String password)
Attempt to establish a database connection that can be used with distributed transactions. |
boolean |
isAnsiQuotedIdentifiers()
|
boolean |
isNoExec()
|
static java.lang.String |
reasonWhyInvalidApplicationName(java.lang.String applicationName)
Return the reason why the supplied application name may be invalid, or null if it is considered valid. |
static java.lang.String |
reasonWhyInvalidDatabaseName(java.lang.String databaseName)
Return the reason why the supplied virtual database name may be invalid, or null if it is considered valid. |
static java.lang.String |
reasonWhyInvalidDatabaseVersion(java.lang.String databaseVersion)
Return the reason why the supplied virtual database version may be invalid, or null if it is considered valid. |
static java.lang.String |
reasonWhyInvalidDataSourceName(java.lang.String dataSourceName)
Return the reason why the supplied data source name may be invalid, or null if it is considered valid. |
static java.lang.String |
reasonWhyInvalidDescription(java.lang.String description)
Return the reason why the supplied description may be invalid, or null if it is considered valid. |
static java.lang.String |
reasonWhyInvalidFetchSize(int fetchSize)
The reason why fetchSize is invalid. |
static java.lang.String |
reasonWhyInvalidPartialResultsMode(java.lang.String partialMode)
The reason why partialResultsMode is invalid. |
static java.lang.String |
reasonWhyInvalidPassword(java.lang.String pwd)
Return the reason why the supplied password may be invalid, or null if it is considered valid. |
static java.lang.String |
reasonWhyInvalidTransactionAutoWrap(java.lang.String autoWrap)
Return the reason why the supplied transaction auto wrap value may be invalid, or null if it is considered valid. |
static java.lang.String |
reasonWhyInvalidUser(java.lang.String userName)
Return the reason why the supplied user name may be invalid, or null if it is considered valid. |
void |
setAdditionalProperties(java.lang.String additionalProperties)
|
void |
setAnsiQuotedIdentifiers(boolean ansiQuotedIdentifiers)
|
void |
setApplicationName(java.lang.String applicationName)
< * Sets the name of the application. |
void |
setAutoCommitTxn(java.lang.String transactionAutoWrap)
Sets the setting for how connections are created by this DataSource manage transactions for client requests with autoCommit = true. |
void |
setDatabaseName(java.lang.String databaseName)
Sets the name of the virtual database on a particular Teiid Server. |
void |
setDatabaseVersion(java.lang.String databaseVersion)
Sets the databaseVersion. |
void |
setDataSourceName(java.lang.String dataSourceName)
Sets the logical name for the underlying XADataSource or
ConnectionPoolDataSource;
used only when pooling connections or distributed transactions are implemented. |
void |
setDescription(java.lang.String description)
Sets the description of this data source. |
void |
setDisableLocalTxn(java.lang.String disableLocalTxn)
|
void |
setFetchSize(int fetchSize)
|
void |
setLoginTimeout(int timeOut)
Sets the maximum time in seconds that this data source can wait while attempting to connect to a database. |
void |
setLogWriter(java.io.PrintWriter writer)
Set the log writer for this data source. |
void |
setNoExec(boolean noExec)
|
void |
setPartialResultsMode(java.lang.String partialResultsMode)
|
void |
setPassword(java.lang.String password)
Sets the password. |
void |
setResultSetCacheMode(java.lang.String resultSetCacheMode)
|
void |
setShowPlan(java.lang.String showPlan)
|
void |
setTransactionAutoWrap(java.lang.String transactionAutoWrap)
Deprecated. |
void |
setUser(java.lang.String user)
Sets the user. |
protected void |
validateProperties(java.lang.String userName,
java.lang.String password)
|
| Methods inherited from class org.teiid.jdbc.WrapperImpl |
|---|
isWrapperFor, unwrap |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.sql.DataSource |
|---|
getConnection |
| Methods inherited from interface java.sql.Wrapper |
|---|
isWrapperFor, unwrap |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_APP_NAME
public static final java.lang.String VDB_NAME
public static final java.lang.String VDB_VERSION
public static final java.lang.String VERSION
public static final java.lang.String APP_NAME
public static final java.lang.String USER_NAME
public static final java.lang.String PASSWORD
protected static final int DEFAULT_TIMEOUT
protected static final int DEFAULT_LOG_LEVEL
public static final java.lang.String JDBC
protected static final int DEFAULT_FETCH_SIZE
protected static final java.lang.String DEFAULT_PARTIAL_RESULTS_MODE
protected static final java.lang.String DEFAULT_RESULT_SET_CACHE_MODE
public static final java.lang.String TXN_WRAP_OFF
public static final java.lang.String TXN_WRAP_ON
public static final java.lang.String TXN_WRAP_AUTO
| Constructor Detail |
|---|
public BaseDataSource()
| Method Detail |
|---|
protected java.util.Properties buildProperties(java.lang.String userName,
java.lang.String password)
protected void validateProperties(java.lang.String userName,
java.lang.String password)
throws java.sql.SQLException
java.sql.SQLException
public java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLException - if a database-access error occursDataSource.getConnection()
public javax.sql.XAConnection getXAConnection()
throws java.sql.SQLException
getXAConnection in interface javax.sql.XADataSourcejava.sql.SQLExceptionXADataSource.getXAConnection()
public javax.sql.XAConnection getXAConnection(java.lang.String userName,
java.lang.String password)
throws java.sql.SQLException
getXAConnection in interface javax.sql.XADataSourceuserName - the database user on whose behalf the XAConnection is being madepassword - the user's password
java.sql.SQLException - if a database-access error occursXADataSource.getXAConnection(java.lang.String, java.lang.String)
public javax.sql.PooledConnection getPooledConnection()
throws java.sql.SQLException
getPooledConnection in interface javax.sql.ConnectionPoolDataSourcejava.sql.SQLException
public javax.sql.PooledConnection getPooledConnection(java.lang.String userName,
java.lang.String password)
throws java.sql.SQLException
getPooledConnection in interface javax.sql.ConnectionPoolDataSourcejava.sql.SQLExceptionpublic java.lang.String getDisableLocalTxn()
public void setDisableLocalTxn(java.lang.String disableLocalTxn)
public java.io.PrintWriter getLogWriter()
throws java.sql.SQLException
The log writer is a character output stream to which all logging and tracing
messages for this data source object instance 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 DriverManager class. When a DataSource object is
created the log writer is initially null, in other words, logging is disabled.
getLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLException - if a database-access error occursCommonDataSource.getLogWriter()
public int getLoginTimeout()
throws java.sql.SQLException
getLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLException - if a database-access error occursCommonDataSource.getLoginTimeout()
public void setLogWriter(java.io.PrintWriter writer)
throws java.sql.SQLException
The log writer is a character output stream to which all logging and tracing
messages for this data source object instance 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 DriverManager class. When a DataSource object is
created the log writer is initially null, in other words, logging is disabled.
setLogWriter in interface javax.sql.CommonDataSourcewriter - the log writer for this data source, null if disabled
java.sql.SQLException - if a database-access error occursCommonDataSource.setLogWriter(java.io.PrintWriter)
public void setLoginTimeout(int timeOut)
throws java.sql.SQLException
setLoginTimeout in interface javax.sql.CommonDataSourcetimeOut - the data source login time limit
java.sql.SQLException - if a database-access error occursCommonDataSource.setLoginTimeout(int)public java.lang.String getApplicationName()
public java.lang.String getDatabaseName()
public java.lang.String getDatabaseVersion()
public java.lang.String getDataSourceName()
XADataSource or
ConnectionPoolDataSource;
used only when pooling connections or distributed transactions are implemented.
public java.lang.String getDescription()
public java.lang.String getUser()
public java.lang.String getPassword()
public void setApplicationName(java.lang.String applicationName)
applicationName - The applicationName to setpublic void setDatabaseName(java.lang.String databaseName)
databaseName - The name of the virtual databasepublic void setDatabaseVersion(java.lang.String databaseVersion)
databaseVersion - The version of the virtual databasepublic void setDataSourceName(java.lang.String dataSourceName)
XADataSource or
ConnectionPoolDataSource;
used only when pooling connections or distributed transactions are implemented.
dataSourceName - The dataSourceName for this data source; may be nullpublic void setUser(java.lang.String user)
user - The user to setpublic void setPassword(java.lang.String password)
password - The password for this data sourcepublic void setDescription(java.lang.String description)
description - The description for this data source; may be nullpublic void setPartialResultsMode(java.lang.String partialResultsMode)
public java.lang.String getPartialResultsMode()
public void setFetchSize(int fetchSize)
public int getFetchSize()
public void setResultSetCacheMode(java.lang.String resultSetCacheMode)
public java.lang.String getResultSetCacheMode()
public java.lang.String getShowPlan()
public void setShowPlan(java.lang.String showPlan)
public void setNoExec(boolean noExec)
public boolean isNoExec()
public java.lang.String getTransactionAutoWrap()
getAutoCommitTxn()public void setTransactionAutoWrap(java.lang.String transactionAutoWrap)
transactionAutoWrap - setAutoCommitTxn(String)public java.lang.String getAutoCommitTxn()
public void setAutoCommitTxn(java.lang.String transactionAutoWrap)
The allowable values for this property are:
OFF" - Nothing is ever wrapped in a transaction and the server will execute
multi-source updates happily but outside a transaction. This is least safe but highest performance.
The TXN_WRAP_OFF constant value is provided for convenience.ON" - Always wrap every command in a transaction. This is most safe but lowest
performance.
The TXN_WRAP_ON constant value is provided for convenience.AUTO" - checks if a command requires a transaction and will be automatically wrap it.
This is the default mode.
The TXN_WRAP_AUTO constant value is provided for convenience.
transactionAutoWrap - The transactionAutoWrap to setpublic static java.lang.String reasonWhyInvalidApplicationName(java.lang.String applicationName)
applicationName - a possible value for the property
setApplicationName(String)public static java.lang.String reasonWhyInvalidDatabaseName(java.lang.String databaseName)
databaseName - a possible value for the property
setDatabaseName(String)public static java.lang.String reasonWhyInvalidUser(java.lang.String userName)
userName - a possible value for the property
setUser(String)public static java.lang.String reasonWhyInvalidTransactionAutoWrap(java.lang.String autoWrap)
This method checks to see that the value is one of the allowable values.
autoWrap - a possible value for the auto wrap property.
setTransactionAutoWrap(String)public static java.lang.String reasonWhyInvalidDatabaseVersion(java.lang.String databaseVersion)
databaseVersion - a possible value for the property
setDatabaseVersion(String)public static java.lang.String reasonWhyInvalidDataSourceName(java.lang.String dataSourceName)
dataSourceName - a possible value for the property
setDataSourceName(String)public static java.lang.String reasonWhyInvalidPassword(java.lang.String pwd)
pwd - a possible value for the property
setPassword(String)public static java.lang.String reasonWhyInvalidDescription(java.lang.String description)
description - a possible value for the property
setDescription(String)public static java.lang.String reasonWhyInvalidPartialResultsMode(java.lang.String partialMode)
partialMode - boolean flag
public static java.lang.String reasonWhyInvalidFetchSize(int fetchSize)
fetchSize - Number of rows per batch
public void setAdditionalProperties(java.lang.String additionalProperties)
public java.lang.String getAdditionalProperties()
public void setAnsiQuotedIdentifiers(boolean ansiQuotedIdentifiers)
public boolean isAnsiQuotedIdentifiers()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||