com.ibm.ws.extensionhelper
Interface DatabaseHelper
- public interface DatabaseHelper
Use the ExtensionHelper.getDatabaseHelper(java.util.Map)
method to retrieve an instance of this interface.
Field Summary
Modifier and Type | Field and Description |
---|---|
|
AUTH_APPLICATION
Resource authorization type: Application
|
|
AUTH_CONTAINER
Resource authorization type: Container
|
|
DBTYPE_DB2
DB2 Database on a Non i-series or z-series platform
|
|
DBTYPE_DB2ISERIES
DB2 Database on a i-series
|
|
DBTYPE_DB2j
Deprecated. Please switch to the Derby database and use DBTYPE_DERBY instead.
|
|
DBTYPE_DB2ZSERIES
DB2 Database on a z-series
|
|
DBTYPE_DERBY
Derby Database
|
|
DBTYPE_INFORMIX
Informix Database
|
|
DBTYPE_INFORMIX7
Deprecated. Informix version 7 is not supported.
|
|
DBTYPE_MSSQL
Microsoft SQL 2000 (or higher) Database
|
|
DBTYPE_MSSQL7
Deprecated. Microsoft SQL Server version 7 is not supported.
|
|
DBTYPE_ORACLE
Oracle Database
|
|
DBTYPE_ORACLETHICK
Oracle Database using Native Driver
|
|
DBTYPE_SYBASE
Sybase Database
|
|
KEY_DATASOURCE_CLASSNAME
The key to the MAP to specify the implementation class name of the datasource.
|
|
KEY_DATASOURCE_CLASSPATH
Key for the Map to specify the classpath to the database implementation classes.
|
|
KEY_DATASOURCE_JNDI_NAME
Key for Data Source JNDI Name to lookup.
|
|
KEY_DATASOURCE_PASSWORD
Key for password to use with user name in a getConnection call.
|
|
KEY_DATASOURCE_PROPERTIES
Key for the Map to specify a properties object which contains additional, database
implmentation specific settings for the database driver.
|
|
KEY_DATASOURCE_USERNAME
Key for user name to use for a getConnection call.
|
|
KEY_REPLACEMENT_MAP
Key for Map to use for replacing various strings in SQL statements, depending on database.
|
|
KEY_STATEMENTS_FILE
Key for file name to load SQL Statements from.
|
|
KEY_TABLE_PREFIX
Key for table prefix to use.
|
|
RESREF_AUTH
Key for type of authorization to use for Resource.
|
|
RESREF_SHARING
Key for type of Resource Sharing to use.
|
|
RESREF_TRANSACTION
Key for type of transaction to use.
|
|
SHARING_SHAREABLE
Resource sharing type: Shareable
|
|
SHARING_UNSHAREABLE
Resource sharing type: Unshareable
|
|
TRANSACTION_NONE
Resource transaction isolation level: None
|
|
TRANSACTION_READ_COMMITTED
Resource transaction isolation level: Comitted Read
|
|
TRANSACTION_READ_UNCOMMITTED
Resource transaction isolation level: Uncommitted Read
|
|
TRANSACTION_REPEATABLE_READ
Resource transaction isolation level: Repeatable Read
|
|
TRANSACTION_SERIALIZABLE
Resource transaction isolation level: Serializable
|
|
TRANSACTION_SNAPSHOT
Resource transaction isolation level: Snapshot (Microsoft SQL Server 2005 & up only).
|
|
TRANSACTION_SS_SNAPSHOT
Resource transaction isolation level: Snapshot (Microsoft SQL Server 2005 & up only).
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
dumpNestedSQLException(java.sql.SQLException sqle)
Utility function to Print a SQLException and any nested exceptions
|
|
dumpSQLExceptionInfo(java.lang.Throwable e)
Utility function to Print a SQLException and any nested exceptions
|
|
existsTable(java.lang.String tableName)
Check whether the table name exists in current database.
|
|
existsTable(java.lang.String tableName,java.sql.Connection con)
Check whether the table name exists in current database
If the table exists, return true.
|
|
getConnection()
Get a connection from Database
|
|
getConnection(TxHandle txHandle)
Creates a connection to the database using a specific txHandle.
|
|
getDatabaseType()
Get Type of Database in use.
|
|
getDataSource()
Returns current Datasource in use
|
|
getRealTableName(java.lang.String tableKey)
Returns table name this appeds table prefix to provided table key.
|
|
getSQLStatement(java.lang.String statementType,java.lang.String tableKey)
Returns a sql statement loaded from statements file using the parameter as hints.
|
|
getSQLStatement(java.lang.String statementType,java.lang.String tableKey,java.lang.String databaseType)
Returns a sql statement loaded from statements file using the parameter as hints
|
|
getTablePrefixName()
Return the table prefix name.
|
getTransactionControl()
Retrieve the TransactionControl associated with this DatabaseHelper.
|
|
|
returnConnection(java.sql.Connection con)
Return Connection.
|
Field Detail
RESREF_AUTH
- static final java.lang.String RESREF_AUTH
RESREF_SHARING
- static final java.lang.String RESREF_SHARING
RESREF_TRANSACTION
- static final java.lang.String RESREF_TRANSACTION
AUTH_APPLICATION
- static final java.lang.Integer AUTH_APPLICATION
AUTH_CONTAINER
- static final java.lang.Integer AUTH_CONTAINER
SHARING_SHAREABLE
- static final java.lang.Integer SHARING_SHAREABLE
SHARING_UNSHAREABLE
- static final java.lang.Integer SHARING_UNSHAREABLE
TRANSACTION_NONE
- static final java.lang.Integer TRANSACTION_NONE
TRANSACTION_READ_UNCOMMITTED
- static final java.lang.Integer TRANSACTION_READ_UNCOMMITTED
TRANSACTION_READ_COMMITTED
- static final java.lang.Integer TRANSACTION_READ_COMMITTED
TRANSACTION_REPEATABLE_READ
- static final java.lang.Integer TRANSACTION_REPEATABLE_READ
TRANSACTION_SERIALIZABLE
- static final java.lang.Integer TRANSACTION_SERIALIZABLE
TRANSACTION_SNAPSHOT
- static final java.lang.Integer TRANSACTION_SNAPSHOT
Resource transaction isolation level: Snapshot (Microsoft SQL Server 2005 & up only). The value of 16 is taken from the DataDirect Connect JDBC driver constant,
com.ddtek.jdbc.extensions.ExtConstants.TRANSACTION_SNAPSHOT
TRANSACTION_SS_SNAPSHOT
- static final java.lang.Integer TRANSACTION_SS_SNAPSHOT
Resource transaction isolation level: Snapshot (Microsoft SQL Server 2005 & up only). The value of 4096 is taken from the Microsoft SQL Server JDBC driver constant,
com.microsoft.sqlserver.jdbc.SQLServerConnection.TRANSACTION_SNAPSHOT
DBTYPE_DB2
- static final java.lang.String DBTYPE_DB2
DBTYPE_DB2ISERIES
- static final java.lang.String DBTYPE_DB2ISERIES
DBTYPE_DB2ZSERIES
- static final java.lang.String DBTYPE_DB2ZSERIES
DBTYPE_DB2j
- static final java.lang.String DBTYPE_DB2j
DBTYPE_DERBY
- static final java.lang.String DBTYPE_DERBY
DBTYPE_ORACLE
- static final java.lang.String DBTYPE_ORACLE
DBTYPE_ORACLETHICK
- static final java.lang.String DBTYPE_ORACLETHICK
DBTYPE_SYBASE
- static final java.lang.String DBTYPE_SYBASE
DBTYPE_MSSQL
- static final java.lang.String DBTYPE_MSSQL
DBTYPE_MSSQL7
- static final java.lang.String DBTYPE_MSSQL7
DBTYPE_INFORMIX
- static final java.lang.String DBTYPE_INFORMIX
DBTYPE_INFORMIX7
- static final java.lang.String DBTYPE_INFORMIX7
KEY_DATASOURCE_JNDI_NAME
- static final java.lang.String KEY_DATASOURCE_JNDI_NAME
KEY_DATASOURCE_USERNAME
- static final java.lang.String KEY_DATASOURCE_USERNAME
KEY_DATASOURCE_PASSWORD
- static final java.lang.String KEY_DATASOURCE_PASSWORD
KEY_STATEMENTS_FILE
- static final java.lang.String KEY_STATEMENTS_FILE
Provides the name of a file to store SQL statements in. This file is a standard properties file. The format of this file is: <TABLE_KEY><DBTYPE><STATEMENT_TYPE>
PROJECT1_DEFAULT_FINDBYPRIMARYKEY= SELECT * FROM <table_prefix>PRJ1 WHERE PROJECT1_DEFAULT_FINDBYPKRANGE= SELECT * FROM <table_prefix>PRJ1 WHERE PK BETWEEN ? AND ? PROJECT1_INFORMIX7_FINDBYPKRANGE= SELECT * FROM <table_prefix>PRJ1 WHERE PK BETWEENAND
To retrieve the digested version of the SQL string, use the following syntax:
databaseHelper.getSQLStatement("FINDPKRANGE", "PROJECT1");
This will automatically use the INFORMIX7 SQL string if the defined DatabaseHelper instance has a databsase type of DBTYPE_INFORMIX7
KEY_TABLE_PREFIX
- static final java.lang.String KEY_TABLE_PREFIX
If the SQL Statements have a <table_prefix> string, it is replaced with the value associated with this
key.
For example:
- There is a SQL statement such as "SELECT ID FROM <table_prefix>TBL" table will result
- The TABLE_PREFIX_KEY is set to "TEST"
KEY_REPLACEMENT_MAP
- static final java.lang.String KEY_REPLACEMENT_MAP
For example: If you have a list of strings to be replaced for the supplied SQL statements:
Map replMap = new HashMap();
replMap.put("
KEY_DATASOURCE_CLASSPATH
- static final java.lang.String KEY_DATASOURCE_CLASSPATH
KEY_DATASOURCE_CLASSNAME
- static final java.lang.String KEY_DATASOURCE_CLASSNAME
KEY_DATASOURCE_PROPERTIES
- static final java.lang.String KEY_DATASOURCE_PROPERTIES
Method Detail
getDatabaseType
- java.lang.String getDatabaseType( )
getConnection
- java.sql.Connection getConnection( )
- throws java.sql.SQLException
java.sql.SQLException
- If a exception occurs during getConnection returnConnection
- void returnConnection(java.sql.Connection con)
- throws java.sql.SQLException
con
- JDBC Connection in use to return. java.sql.SQLException
- If a Exception occurs during getRealTableName
- java.lang.String getRealTableName( java.lang.String tableKey)
tableKey
- Key to use for obtaining real table name getDataSource
- javax.sql.DataSource getDataSource( )
getSQLStatement
- java.lang.String getSQLStatement( java.lang.String statementType,
- java.lang.String tableKey)
statementType
- Type of Statement insert, update etc tableKey
- Unique key for the table getSQLStatement
- java.lang.String getSQLStatement( java.lang.String statementType,
- java.lang.String tableKey,
- java.lang.String databaseType)
statementType
- Type of Statement insert, update etc databaseType
- the database type tableKey
- Unique key for the table dumpNestedSQLException
- void dumpNestedSQLException(java.sql.SQLException sqle)
sqle
- Exception to print dumpSQLExceptionInfo
- void dumpSQLExceptionInfo(java.lang.Throwable e)
e
- Throwable to print existsTable
- boolean existsTable(java.lang.String tableName)
tableName
- Name of table to check existsTable
- boolean existsTable(java.lang.String tableName,
- java.sql.Connection con)
tableName
- name of the table to check con
- the connection to use to test the table with. getTablePrefixName
- java.lang.String getTablePrefixName( )
getConnection
- java.sql.Connection getConnection( TxHandle txHandle)
- throws java.sql.SQLException
txHandle
- java.sql.SQLException
getTransactionControl
- TransactionControl getTransactionControl( )