Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Real-Time Decisions
11g Release 1 (11.1.1)

E17787-01


com.sigmadynamics.server.DataServices.DatabaseProvider
Class DatabaseProvider

java.lang.Object
  extended by com.sigmadynamics.server.DataServices.DatabaseProvider.DatabaseProvider

All Implemented Interfaces:
DatabaseProviderInterface

public class DatabaseProvider
extends java.lang.Object
implements DatabaseProviderInterface

This class provides platform support for reading, updating, deleting, and inserting records across many different types of databases.

Since:
1.0

Field Summary
static DatabaseSettings SETTINGS
           

 

Fields inherited from interface com.sigmadynamics.server.DataServices.DatabaseProvider.DatabaseProviderInterface
DBTYPE_DB2, DBTYPE_MSSQLSERVER, DBTYPE_MYSQL, DBTYPE_ORACLE, DBTYPE_SIEBEL_ANALYTICS, DBTYPE_UNKNOWN

 

Constructor Summary
  DatabaseProvider(SDDataSource dataSource)
          Deprecated. since 3.0. Please use DatabaseProvider.DatabaseProvider(SDDataSourceInterface) instead.
  DatabaseProvider(SDDataSourceInterface dataSource)
           Initializes a newly created DatabaseProvider with a data source specified by data source.
protected DatabaseProvider(SDDataSourceInterface dataSource, boolean start)
           
  DatabaseProvider(java.lang.String dataSourceName)
           

 

Method Summary
static void closeConnection(java.sql.Connection conn)
          Deprecated. as of 11.1.1.1.2.0, Use Util.closeConnection(Connection) instead
static void closeResultSet(java.sql.ResultSet rs)
          Deprecated. as of 11.1.1.1.2.0, Use Util.closeResultSet(ResultSet) instead
static void closeStatement(java.sql.Statement stmt)
          Deprecated. as of 11.1.1.1.2.0, Use Util.closeStatement(Statement) instead
 java.sql.Connection getConnection()
           
 int getDatabaseType()
           
 SDDataSourceInterface getDataSource()
           
 DeadlockHandler getDeadlockHandler()
          Returns a new deadlock handler object.
 ManualFlushTableInserter getManualFlushTableInserter(java.lang.String table, java.lang.String[] columns, int bufferSize, boolean autoGrowBuffer)
          Returns a manually-flushed batched TableInserter that can be used for inserting data into a database table.
 DatabaseProviderMetaData getMetaData()
           
 StoredProcedure getStoredProcedure(java.lang.String storedProcedureName, int paramCount)
          Returns a StoredProcedure object that is used to call stored procedures in a database.
 StoredProcCacheEntry getStoredProcInfo(java.lang.String procName, boolean refresh)
           
 TableCacheEntry getTableCacheEntry(java.lang.String tableName, boolean refresh)
          get the cache entry for the specified table
 TableDeleter getTableDeleter(java.lang.String table)
          Returns a TableDeleter that can be used for deleting rows in a database table.
 TableDeleter getTableDeleter(java.lang.String table, int batchSize, int maxQueueLength)
          Returns a TableDeleter that can be used for deleting rows in a database table.
 TableDeleter getTableDeleter(java.lang.String table, java.lang.String[] whereColumns)
          Returns a TableDeleter that can be used for deleting rows from a database table, one at a time.
 TableDeleter getTableDeleter(java.lang.String table, java.lang.String[] whereColumns, int whereType, int batchSize, int maxQueueLength)
          Returns a TableDeleter that can be used for deleting rows in a database table.
 TableDeleter getTableDeleter(java.lang.String table, java.lang.String[] whereColumns, java.lang.String where, int batchSize, int maxQueueLength)
          Returns a TableDeleter that can be used for deleting rows in a database table.
 TableCacheEntry getTableInfo(java.lang.String tableName)
           
 TableInserter getTableInserter(java.lang.String table, java.lang.String... columns)
          Returns an un-batched TableInserter that can be used for inserting data into database tables, one row at a time.
 TableInserter getTableInserter(java.lang.String table, java.lang.String[] columns, int batchSize, int maxQueueLength)
          Returns an auto-flush batched TableInserter that can be used for inserting data into a database table.
 TableReader getTableReader(java.lang.String table, java.lang.String[] columns)
          Returns a TableReader that can be used for reading a database table.
 TableReader getTableReader(java.lang.String table, java.lang.String[] columns, java.lang.String[] whereColumns)
          Returns a TableReader that can be used for reading a database table.
 TableReader getTableReader(java.lang.String table, java.lang.String[] columns, java.lang.String[] whereColumns, int whereType)
          Returns a TableReader that can be used for reading a database table.
 TableReader getTableReader(java.lang.String table, java.lang.String[] columns, java.lang.String[] whereColumns, java.lang.String where)
          Returns a TableReader that can be used for reading a database table.
 TableUpdater getTableUpdater(java.lang.String table, java.lang.String[] columns)
          Returns a TableUpdater that can be used for updating data in a database table.
 TableUpdater getTableUpdater(java.lang.String table, java.lang.String[] columns, int batchSize, int maxQueueLength)
          Returns a TableUpdater that can be used for updating data in a database table.
 TableUpdater getTableUpdater(java.lang.String table, java.lang.String[] columns, java.lang.String[] whereColumns, int whereType, int batchSize, int maxQueueLength)
          Returns a TableUpdater that can be used for updating data in a database table.
 TableUpdater getTableUpdater(java.lang.String table, java.lang.String[] columns, java.lang.String[] whereColumns, java.lang.String where, int batchSize, int maxQueueLength)
          Returns a TableUpdater that can be used for updating data in a database table.
 WriteOnlyStoredProcedure getWriteOnlyStoredProcedure(java.lang.String storedProcedureName, int paramCount, int batchSize, int maxQueueLength)
          Returns a WriteOnlyStoredProcedure that can be used to call a stored procedure that updates data in a database but does not return any data.
 boolean isCaseSensitive()
          Indicates whether the datasource associated with the DataProvider is case sensitive.
 void removeProcedureCacheEntry(java.lang.String procName)
           
 boolean supportsBatchUpdates()
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

SETTINGS

public static final DatabaseSettings SETTINGS

Constructor Detail

DatabaseProvider

@Deprecated
public DatabaseProvider(SDDataSource dataSource)
Deprecated. since 3.0. Please use DatabaseProvider.DatabaseProvider(SDDataSourceInterface) instead.
Since:
1.0

DatabaseProvider

public DatabaseProvider(SDDataSourceInterface dataSource)

Initializes a newly created DatabaseProvider with a data source specified by data source.

A DatabaseProvider is used to obtain the other objects that are part of the DatabaseProvider API, e.g. TableReader or TableInserter. The DatabaseProvider class keeps a system-wide cache of metadata so that it doesn't need to go to the database every time.

There is no need to close or release a DatabaseProvider instance.

Parameters:
dataSource - an object that the J2EE app server uses to get connections.
Since:
3.0

DatabaseProvider

protected DatabaseProvider(SDDataSourceInterface dataSource,
                           boolean start)

DatabaseProvider

public DatabaseProvider(java.lang.String dataSourceName)
Since:
1.0

Method Detail

supportsBatchUpdates

public boolean supportsBatchUpdates()
Specified by:
supportsBatchUpdates in interface DatabaseProviderInterface

getConnection

public java.sql.Connection getConnection()
Specified by:
getConnection in interface DatabaseProviderInterface
Returns:
Connection, never returns null

closeConnection

public static final void closeConnection(java.sql.Connection conn)
Deprecated. as of 11.1.1.1.2.0, Use Util.closeConnection(Connection) instead
no throwables escape this method
Since:
1.0

closeStatement

public static final void closeStatement(java.sql.Statement stmt)
Deprecated. as of 11.1.1.1.2.0, Use Util.closeStatement(Statement) instead
no throwables escape this method
Since:
1.0

closeResultSet

public static final void closeResultSet(java.sql.ResultSet rs)
Deprecated. as of 11.1.1.1.2.0, Use Util.closeResultSet(ResultSet) instead
no throwables escape this method
Since:
1.0

getTableReader

public TableReader getTableReader(java.lang.String table,
                                  java.lang.String[] columns)
Description copied from interface: DatabaseProviderInterface
Returns a TableReader that can be used for reading a database table.

The columns specified by columns are returned. All rows of the table are returned.

Specified by:
getTableReader in interface DatabaseProviderInterface
Parameters:
table - the table to read
columns - the names of the columns to select (the projection). If null, then all columns are selected.
Returns:
the TableReader

getTableReader

public TableReader getTableReader(java.lang.String table,
                                  java.lang.String[] columns,
                                  java.lang.String[] whereColumns,
                                  int whereType)
Description copied from interface: DatabaseProviderInterface
Returns a TableReader that can be used for reading a database table.

The columns specified by columns are returned. The selection of the rows is governed by the 'where' parameters.

Specified by:
getTableReader in interface DatabaseProviderInterface
Parameters:
table - the name of the table to read
columns - the names of the columns to select. A null specifies all columns.
whereColumns - the names of the columns used to select rows (see the Where interface)
whereType - used to specify whether Where terms are intersection or union (see the Where interface)
Returns:
the TableReader
See Also:
Where

getTableReader

public TableReader getTableReader(java.lang.String table,
                                  java.lang.String[] columns,
                                  java.lang.String[] whereColumns)
Description copied from interface: DatabaseProviderInterface
Returns a TableReader that can be used for reading a database table.

The columns specified by columns are returned. The selection of the rows is governed by the 'where' parameters.

Specified by:
getTableReader in interface DatabaseProviderInterface
Parameters:
table - the name of the table to read
columns - the names of the columns to select. A null specifies all columns.
whereColumns - the names of the columns used to select rows. The conditions are combined using AND operators.
Returns:
the TableReader
See Also:
Where

getTableReader

public TableReader getTableReader(java.lang.String table,
                                  java.lang.String[] columns,
                                  java.lang.String[] whereColumns,
                                  java.lang.String where)
Description copied from interface: DatabaseProviderInterface
Returns a TableReader that can be used for reading a database table.

The columns specified by columns are returned. The selection of the rows is governed by the 'where' parameters.

Specified by:
getTableReader in interface DatabaseProviderInterface
Parameters:
table - the name of the table to read
columns - the names of the columns to select. A null specifies all columns.
whereColumns - the names of the columns used to select rows (see the Where interface)
where - a string used in constructing a WHERE clause (see the Where interface)
Returns:
the TableReader

getTableInserter

public TableInserter getTableInserter(java.lang.String table,
                                      java.lang.String... columns)
Description copied from interface: DatabaseProviderInterface
Returns an un-batched TableInserter that can be used for inserting data into database tables, one row at a time.

The columns into which data will be inserted are specified by columns. Batch operation is enabled if the batchSize parameter is greater than one and the database supports batch operations.

Specified by:
getTableInserter in interface DatabaseProviderInterface
Parameters:
table - the name of the table to insert data into
columns - the names of the columns to insert data into
Returns:
the TableInserter

getTableInserter

public TableInserter getTableInserter(java.lang.String table,
                                      java.lang.String[] columns,
                                      int batchSize,
                                      int maxQueueLength)
Description copied from interface: DatabaseProviderInterface
Returns an auto-flush batched TableInserter that can be used for inserting data into a database table.

The columns into which data will be inserted are specified by columns. Batch operation is enabled if the batchSize parameter is greater than one and the database supports batch operations.

Specified by:
getTableInserter in interface DatabaseProviderInterface
Parameters:
table - the name of the table to insert data into
columns - the names of the columns to insert data into
batchSize - the number of insert operations to batch together before submitting them to the database
Returns:
the TableInserter

getManualFlushTableInserter

public ManualFlushTableInserter getManualFlushTableInserter(java.lang.String table,
                                                            java.lang.String[] columns,
                                                            int bufferSize,
                                                            boolean autoGrowBuffer)
Description copied from interface: DatabaseProviderInterface
Returns a manually-flushed batched TableInserter that can be used for inserting data into a database table.

The columns into which data will be inserted are specified by columns. Batch operation is enabled if the bufferSize parameter is greater than one and the database supports batch operations.

Specified by:
getManualFlushTableInserter in interface DatabaseProviderInterface
Parameters:
table - the name of the table to insert data into
columns - the names of the columns to insert data into
bufferSize - the initial buffer will be large enough to hold this number of insert operations.
autoGrowBuffer - true if the buffer should automatically grow when an attempt is made to insert too many rows. If false, an SDRunTimeException will be thrown.
Returns:
the TableInserter

getTableUpdater

public TableUpdater getTableUpdater(java.lang.String table,
                                    java.lang.String[] columns)
Description copied from interface: DatabaseProviderInterface
Returns a TableUpdater that can be used for updating data in a database table.

The columns that are to be updated are specified by columns. Batch operation is enabled if the batchSize parameter is greater than one and the database supports batch operations.

Specified by:
getTableUpdater in interface DatabaseProviderInterface
Parameters:
table - the name of the table which is to be updated
columns - the names of the columns which are to be updated
Returns:
the TableUpdater

getTableUpdater

public TableUpdater getTableUpdater(java.lang.String table,
                                    java.lang.String[] columns,
                                    int batchSize,
                                    int maxQueueLength)
Description copied from interface: DatabaseProviderInterface
Returns a TableUpdater that can be used for updating data in a database table.

The columns that are to be updated are specified by columns. Batch operation is enabled if the batchSize parameter is greater than one and the database supports batch operations.

Specified by:
getTableUpdater in interface DatabaseProviderInterface
Parameters:
table - the name of the table which is to be updated
columns - the names of the columns which are to be updated
batchSize - the number of update operations to batch together before submitting them to the database
Returns:
the TableUpdater

getTableUpdater

public TableUpdater getTableUpdater(java.lang.String table,
                                    java.lang.String[] columns,
                                    java.lang.String[] whereColumns,
                                    int whereType,
                                    int batchSize,
                                    int maxQueueLength)
Description copied from interface: DatabaseProviderInterface
Returns a TableUpdater that can be used for updating data in a database table.

The columns that are to be updated are specified by columns. Batch operation is enabled if the batchSize parameter is greater than one and the database supports batch operations. The selection of the rows is governed by the 'where' parameters.

Specified by:
getTableUpdater in interface DatabaseProviderInterface
Parameters:
table - the name of the table which is to be updated
columns - the names of the columns which are to be updated
whereColumns - the names of the columns used to select rows (see the Where interface)
whereType - used to specify whether Where terms are intersection or union (see the Where interface)
batchSize - the number of update operations to batch together before submitting to the database
Returns:
the TableUpdater

getTableUpdater

public TableUpdater getTableUpdater(java.lang.String table,
                                    java.lang.String[] columns,
                                    java.lang.String[] whereColumns,
                                    java.lang.String where,
                                    int batchSize,
                                    int maxQueueLength)
Description copied from interface: DatabaseProviderInterface
Returns a TableUpdater that can be used for updating data in a database table.

The columns that are to be updated are specified by columns. Batch operation is enabled if the batchSize parameter is greater than one and the database supports batch operations. The selection of the rows is governed by the 'where' parameters.

Specified by:
getTableUpdater in interface DatabaseProviderInterface
Parameters:
table - the name of the table which is to be updated
columns - the names of the columns which are to be updated
whereColumns - the names of the columns used to select rows (see the Where interface)
where - a string used in constructing a WHERE clause (see the Where interface)
batchSize - the number of update operations to batch together before submitting to the database
Returns:
the TableUpdater

getTableDeleter

public TableDeleter getTableDeleter(java.lang.String table)
Description copied from interface: DatabaseProviderInterface
Returns a TableDeleter that can be used for deleting rows in a database table.

Batch operation is enabled if the batchSize parameter is greater than one and the database supports batch operations.

Specified by:
getTableDeleter in interface DatabaseProviderInterface
Parameters:
table - the name of the table from which rows will be deleted
Returns:
the TableDeleter

getTableDeleter

public TableDeleter getTableDeleter(java.lang.String table,
                                    int batchSize,
                                    int maxQueueLength)
Description copied from interface: DatabaseProviderInterface
Returns a TableDeleter that can be used for deleting rows in a database table.

Batch operation is enabled if the batchSize parameter is greater than one and the database supports batch operations.

Specified by:
getTableDeleter in interface DatabaseProviderInterface
Parameters:
table - the name of the table from which rows will be deleted
batchSize - the number of delete operations to batch together before submitting them to the database
Returns:
the TableDeleter

getTableDeleter

public TableDeleter getTableDeleter(java.lang.String table,
                                    java.lang.String[] whereColumns,
                                    int whereType,
                                    int batchSize,
                                    int maxQueueLength)
Description copied from interface: DatabaseProviderInterface
Returns a TableDeleter that can be used for deleting rows in a database table.

Batch operation is enabled if the batchSize parameter is greater than one and the database supports batch operations.

Specified by:
getTableDeleter in interface DatabaseProviderInterface
Parameters:
table - the name of the table from which rows will be deleted
whereColumns - the names of the columns used to select rows (see the Where interface)
whereType - used to specify whether Where terms are intersection or union (see the Where interface)
batchSize - the number of delete operations to batch together before submitting them to the database
Returns:
the TableDeleter

getTableDeleter

public TableDeleter getTableDeleter(java.lang.String table,
                                    java.lang.String[] whereColumns)
Description copied from interface: DatabaseProviderInterface
Returns a TableDeleter that can be used for deleting rows from a database table, one at a time.

Batch operation is disabled.

Specified by:
getTableDeleter in interface DatabaseProviderInterface
Parameters:
table - the name of the table from which rows will be deleted
whereColumns - the names of the columns used to select rows. The conditions are combined using AND operators.
Returns:
the TableDeleter
See Also:
Where

getTableDeleter

public TableDeleter getTableDeleter(java.lang.String table,
                                    java.lang.String[] whereColumns,
                                    java.lang.String where,
                                    int batchSize,
                                    int maxQueueLength)
Description copied from interface: DatabaseProviderInterface
Returns a TableDeleter that can be used for deleting rows in a database table.

Batch operation is enabled if the batchSize parameter is greater than one and the database supports batch operations.

The selection of the rows is governed by the 'where' parameters.

Specified by:
getTableDeleter in interface DatabaseProviderInterface
Parameters:
table - the name of the table from which rows will be deleted
whereColumns - the names of the columns used to select rows (see the Where interface)
where - a string used in constructing a WHERE clause (see the Where interface)
batchSize - the number of delete operations to batch together before submitting them to the database
Returns:
the TableDeleter

getStoredProcedure

public StoredProcedure getStoredProcedure(java.lang.String storedProcedureName,
                                          int paramCount)
Description copied from interface: DatabaseProviderInterface
Returns a StoredProcedure object that is used to call stored procedures in a database.

Don't forget to call WriteOnlyStoredProcedure.close()

Specified by:
getStoredProcedure in interface DatabaseProviderInterface
Parameters:
storedProcedureName - the name of the stored procedure
paramCount - a parameter that is either the number of parameters to use or StoredProcedure.ALL_PARAMETERS. The latter means that it will automatically discover the number of parameters.
Returns:
the StoredProcedure object

getWriteOnlyStoredProcedure

public WriteOnlyStoredProcedure getWriteOnlyStoredProcedure(java.lang.String storedProcedureName,
                                                            int paramCount,
                                                            int batchSize,
                                                            int maxQueueLength)
Description copied from interface: DatabaseProviderInterface
Returns a WriteOnlyStoredProcedure that can be used to call a stored procedure that updates data in a database but does not return any data.

Batch operation is enabled if the batchSize parameter is greater than one and the database supports batch operations.

Specified by:
getWriteOnlyStoredProcedure in interface DatabaseProviderInterface
Parameters:
storedProcedureName - the name of the stored procedure
paramCount - a parameter that is either the number of parameters to use or StoredProcedure.ALL_PARAMETERS. The latter means that it will automatically discover the number of parameters.
batchSize - the number of stored procedure calls to batch together before submitting them to the database
Returns:
the StoredProcedure object

getMetaData

public DatabaseProviderMetaData getMetaData()
Specified by:
getMetaData in interface DatabaseProviderInterface

isCaseSensitive

public boolean isCaseSensitive()
Description copied from interface: DatabaseProviderInterface
Indicates whether the datasource associated with the DataProvider is case sensitive. This case sensitivity is for unqualified database identifiers
Specified by:
isCaseSensitive in interface DatabaseProviderInterface
Returns:
true if the datasource associated with the DataProvider is case sensitive.

getDatabaseType

public int getDatabaseType()
Specified by:
getDatabaseType in interface DatabaseProviderInterface

getTableCacheEntry

public TableCacheEntry getTableCacheEntry(java.lang.String tableName,
                                          boolean refresh)
Description copied from interface: DatabaseProviderInterface
get the cache entry for the specified table

This method was necessitated by the need to get columns info to support Oracle I18n data.

Specified by:
getTableCacheEntry in interface DatabaseProviderInterface

getDataSource

public SDDataSourceInterface getDataSource()
Specified by:
getDataSource in interface DatabaseProviderInterface

getStoredProcInfo

public StoredProcCacheEntry getStoredProcInfo(java.lang.String procName,
                                              boolean refresh)
Specified by:
getStoredProcInfo in interface DatabaseProviderInterface

getTableInfo

public TableCacheEntry getTableInfo(java.lang.String tableName)
Specified by:
getTableInfo in interface DatabaseProviderInterface

removeProcedureCacheEntry

public void removeProcedureCacheEntry(java.lang.String procName)
Specified by:
removeProcedureCacheEntry in interface DatabaseProviderInterface

getDeadlockHandler

public DeadlockHandler getDeadlockHandler()
Returns a new deadlock handler object.

Although a new object is created on each call, this method is only called when exceptions occur. If we determine that this is still too expensive, then we can implement a pool.

A single deadlock handler object is no longer sufficient (as it once was) because various database operations that can produce deadlock may be occurring concurrently and it is common to have state in a deadlock handler, e.g. a count of the number of tries.

Specified by:
getDeadlockHandler in interface DatabaseProviderInterface
Returns:
the deadlock handler object

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Real-Time Decisions
11g Release 1 (11.1.1)

E17787-01


Copyright © 2010, Oracle. All rights reserved.