public class JdbcDatabase
extends java.lang.Object
The JdbcDatabase wraps a DataSource instance,
adding additional features specifically beneficial to Connectors
and the ConnectorManager, such as:
| Constructor and Description |
|---|
JdbcDatabase(javax.sql.DataSource dataSource) |
| Modifier and Type | Method and Description |
|---|---|
DatabaseConnectionPool |
getConnectionPool()
Return the
DatabaseConnectionPool used to maintain a collection
of opened Connections to the DataSource. |
SpiConstants.DatabaseType |
getDatabaseType()
Return the
SpiConstants.DatabaseType for this database. |
javax.sql.DataSource |
getDataSource()
Return the underlying
DataSource for the database instance. |
java.lang.String |
getDescription()
Return a description string for this database.
|
int |
getMaxTableNameLength()
Returns the maximum table name length for this database vendor.
|
java.lang.String |
getProductName()
Return a sanitzed version of the vendor product name.
|
java.lang.String |
getResourceBundleExtension()
Returns the
DatabaseResourceBundle extension that may be added
to a ResourceBundle baseName to build the name of the resource
that is specific to the database implementation identified by this
JdbcDatabase instance. |
boolean |
isDisabled()
Returns
true if the configured JdbcDatabase is unavailable. |
java.lang.String |
makeTableName(java.lang.String prefix,
java.lang.String connectorName)
Constructs a database table name based up the configured table name prefix
and the Connector name.
|
void |
shutdown() |
java.lang.String |
toString() |
boolean |
verifyTableExists(java.lang.String tableName,
java.lang.String[] createTableDdl)
Verify that a table named
tableName exists in the database. |
public void shutdown()
public boolean isDisabled()
true if the configured JdbcDatabase is unavailable.true if this JdbcDatabase is disabled, false
otherwise.public javax.sql.DataSource getDataSource()
DataSource for the database instance.DataSource for the database instance.public DatabaseConnectionPool getConnectionPool()
DatabaseConnectionPool used to maintain a collection
of opened Connections to the DataSource.DatabaseConnectionPool for this databasepublic SpiConstants.DatabaseType getDatabaseType()
SpiConstants.DatabaseType for this database.SpiConstants.DatabaseType for this databasepublic java.lang.String getProductName()
public java.lang.String getDescription()
description stringpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getResourceBundleExtension()
DatabaseResourceBundle extension that may be added
to a ResourceBundle baseName to build the name of the resource
that is specific to the database implementation identified by this
JdbcDatabase instance.
This is will be constructed from the database productName,
majorVersion, and minorVersion separated by underbars
('_'), for instance MySQL v5.6 will return "_mysql_5_6".
public int getMaxTableNameLength()
public java.lang.String makeTableName(java.lang.String prefix,
java.lang.String connectorName)
prefix - the generated table name will begin with this prefixconnectorName - the connector namepublic boolean verifyTableExists(java.lang.String tableName,
java.lang.String[] createTableDdl)
tableName exists in the database.
If not, create it, using the supplied DDL statements.tableName - the name of the table to find in the database.createTableDdl - DDL statements that may be used to create the
table if it does not exist. If null, no attempt will
be made to create the table.true if the table exists or was successfully created,
false if the table does not exist.