Package com.basis.api.admin
Interface BBjAdminDatabase
- All Superinterfaces:
BBjAdminCommitPropertyWriter
,BBjAdminCommitWriter
,BBjAdminPropertyReader
,BBjAdminPropertyWriter
,Comparable<BBjAdminDatabase>
,Remote
,Serializable
- All Known Implementing Classes:
BBjAdminSimpleDatabase
public interface BBjAdminDatabase
extends BBjAdminCommitPropertyWriter, Serializable, Comparable<BBjAdminDatabase>
References an individual database configuration and commands. Provides access to the tables, stored procedures, views, etc. Changes to the database require calls to commit() on the BBjAdminDatabase instance.
The follow code shows some examples for interacting with a BBjAdminDatabas instance including how to get the instance to begin with.
Java Sample
import com.basis.api.admin.BBjAdminFactory;
import com.basis.api.admin.BBjAdminBase;
import com.basis.api.admin.BBjAdminDatabase;
import java.net.InetAddress;
...
BBjAdminBase api = BBjAdminFactory.getBBjAdmin(InetAddress.getByName("myserver"), 2002, true, "admin", "mypassword");
BBjAdminDatabase db = api.getDatabase("ChileCompany");
String databaseName = db.getString(BBjAdminDatabase.DATABASE);
BBjAdminSet tables = db.getTables(false);
BBjAdminTable custTable = db.getTable("CUSTOMER");
String tableName = custTable.getString(BBjAdminTable.NAME);
BBjAdminList columns = custTable.getColumns();
...
BBj Sample
use com.basis.api.admin.BBjAdminFactory
use com.basis.api.admin.BBjAdminBase
use com.basis.api.admin.BBjAdminDatabase
use java.net.InetAddress
...
declare BBjAdminBase api!
declare BBjAdminSet databases!
declare BBjAdminDatabase db!
declare BBjAdminTable custTable!
api! = BBjAdminFactory.getBBjAdmin(InetAddress.getByName("myserver"), 2002, true, "admin", "mypassword")
db! = api!.getDatabase("ChileCompany")
databaseName$ = db!.getString(BBjAdminDatabase.DATABASE)
tables! = db.getTables(0)
custTable! = db!.getTable("CUSTOMER")
tableName$ = custTable!.getString(BBjAdminTable.NAME)
columns! = custTable!.getColumns()
...
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
static enum
static interface
static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The access policy for this database.static final String
Comma-separated list of usernames who have admin privileges on the database.static final String
See ADMIN_USERSstatic final String
True/false whether to use advisory locking when accessing the data files for tables or not.static final String
See ADVISORY_LOCKINGstatic final int
static final int
static final int
static final int
static final String
See AUTO_ANALYZE_TABLESstatic final String
True/false whether to allow BBjServices to automatically run table analysis when it deems appropriate.static final String
True if the default for the database should be to use autocommit.static final String
Used to specify a specific character set used when processing records in the database.static final String
Default type of file created when executing a CREATE TABLE statement.static final String
Full path to the DATA global variable which is a standard variable used in table data file path specifications to avoid hard-coding paths into the database definition.static final String
Case-sensitive name of the database.static final String
Deprecated.static final String
A comma-separated list of typedef/dateformat mappings.static final String
static final String
static final String
static final String
Full path to the data dictionary files (*.1 files for legacy databases, and the *.DD files for enhanced)static final String
If true, variable length columns will only allow values that fit within the defined length.static final String
True/false whether to use collation order on ESQL tables or ASCII order.static final int
Used with the export() method.static final int
Used with the export() method.static final int
Used with the export() method.static final String
True/false to enable/disable creation of views using the "new" format.static final String
NOTE: This is a bit of an unusual setting.static final String
Comma separated list of name=value pairs to be used at connect time.static final String
Property used by linked database configurations to indicate the JDBC driver class.static final String
Property used by linked database configurations to indicate the password used to connect to the database.static final String
Property used by linked database configurations to indicate whether it should resolve any globals used.static final String
Property used by linked database configurations to indicate the URL used to connect to the database.static final String
Property used by linked database configurations to indicate the user used to connect to the database.static final String
Database Locale as a IETF BCP 47 language tag as describes by the Java documentation for java.util.Locale.toLanguageTag().static final String
Deprecated.static final String
static final String
If true, BBj SQL queries will return type NUMERIC values where the underlying data in the raw record (MKEYED, XKEYED, VKEYED, but NOT ESQL) as zero instead of NULL.static final String
If true, strip spaces from numeric field values before they are translated into numbers.static final String
True/false to enable object level permissions.static final String
Deprecated.static final String
If set to true, date columns will have optimization available.static final String
Sets the read only status for the entire database.static final String
Sets the read only status for the entire database.static final String
This is another layer of access that refers specifically to connections coming from machines other than the local machine.static final String
Comma-separated list of users who have been explicitly denied access to the database.static final String
Comma-separated list of users who have read-only access to the database from remote machines.static final String
Comma-separated list of users who have read-write access to the database from remote machines.static final String
Comma-separated list of IP address/hostnames that should NOT be treated as "remote" but rather, follow the permissions defined for local connections.static final String
Comma-separated list of users who have read-only access to the database.static final String
See RO_USERSstatic final String
Comma-separated list of users who have read-write access to the database.static final String
See RW_USERSstatic final String
Alternate classpath to use for stored procedure interpreters if the default classpath is not desireable.static final String
If set to true, dot-step debugging is available when executing stored procedures.static final String
True/false whether stored procedures should be run as the system user or as the user who connected to the database.static final String
BBjSQLFactory implementation class (including package) used to provide custom scalar/group functions accessible by this database.static final String
Session Specific Classpath (SSCP) containing reference to the JAR used to provide custom scalar/group functions accessible by this database.static final String
Timeout in SECONDS for database file operations on statement execution and result set fetching.static final String
Used by CREATE TABLE.static final String
See STRICT_KEY_CHECKINGstatic final String
Timeout in milliseconds for database requests.static final String
If values returned from SQL queries are too long for the defined column, the value will be truncated.static final String
See TRUNCATE_IF_TOO_LONGstatic final String
Default transaction isolation level.static final String
Type of the database. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addUser
(BBjAdminDatabase.UserType p_type, String p_user) Add a single user of a specified type.void
Called to explicitly clear out any cached data such as open connections to the database that were created internally by executing SQL statements on the database through calls to executeSQL().void
close()
Should be called when you are completely done with this instance to cleanup resources used on the server side.Create a new date handler.Returns a new instance of an empty BBjAdminPrivilege object ready to be set for granting or revoking privileges.Create an empty BBjAdminProcedure object to be used for procedure creation.createProcedure
(String p_name) Create an empty BBjAdminProcedure object to be used for procedure creation.void
createRole
(String p_roleName) Creates a new role on the database used for grouping multiple users for the purpose of granting and revoking prvileges.void
createRole
(String p_roleName, String p_comments) Creates a new role on the database used for grouping multiple users for the purpose of granting and revoking prvileges.createSequence
(String p_name) Create an empty BBjAdminSequence object to be used for sequence creation.Create an empty BBjAdminTable object to be used for table creation.createTypeDef
(String p_name) Create an empty BBjAdminTypeDef object to be used for type definition creation.Create an empty BBjAdminView object to be used for view creation.createView
(String p_name) Create an empty BBjAdminView object to be used for view creation.void
dropProcedure
(String p_name) Drop a single procedure and also remove the source code file.void
dropProcedure
(String p_name, boolean p_removeSource) Drop a single procedure.void
Drops the specified role from the database.void
dropSequence
(String p_name) Drop a single sequence.void
Drop a single table.void
Drop a single table.void
dropTypeDef
(String p_name) Drop a single typedef.void
Drop a single view.void
executeSQL
(String p_sql) Executes an SQL statement or list of SQL statements separated by semi-colons.void
export
(String p_location, int p_format, List<String> p_tables, List<String> p_views, List<String> p_sprocs, List<String> p_types, List<String> p_sequences, List<String> p_users, List<String> p_roles) Exports the database to the specified location in the specified format.Get the current access policy.Returns a list of all current connections made to this database.Get the set of date handlers.Used primarily by GUI applications like the Enterprise Manager to dynamically generate an admin UI.getDictionaryMigrationInfo
(String p_newDictionary, String p_dataLocation) Returns information regarding the changes that may want to be made to the "new" dictionary when a call is made to updateDatabase().Returns the definition for all the metadata in this database which includes database metadata, table, view, SPROC, etc.getPrivileges
(String p_userFilter, Integer p_privilegeType, Integer p_objectType, String p_objectIdFilter, String p_sortString) Returns a list of all the privileges for the specified filter criteria.getProcedure
(String p_name) Get an individual procedure in the database by name.Get a set of all of the procedures in the database.getQueryAnalysis
(int p_count) Get a number of suggested indexes from query analysis.getQueryAnalysis
(String p_tableFilter, int p_filterFlag, int p_count) Get a filtered number of suggested indexes from query analysis.getQueryData
(String p_tableFilter) Returns a list of BBjAdminQueryData objects, one for each table that matches the table filter criteria.getRoleMembers
(String p_roleName) Returns a list of the users who are currently part of the specified role.getRoles()
Returns a list of all the names of the roles currently in the database.Returns objects that contain information about the "sanity" of a particular database table.Returns objects that contain information about the "sanity" of a particular database table.getSequence
(String p_name) Get an individual sequence in the database by name.Get a set of all of the sequences in the database.Get an individual table in the database by name.Get an individual table from the database.getTableNames
(boolean p_includeSystemTables, boolean p_refresh) Returns a list of the table names available in the database sorted alphabetically.getTables
(boolean p_includeSystemTables) Get a set of all of the tables in the database, optionally including the system tables.getTablesSimpleInfo
(boolean p_includeSystemTables) Get a set of all of the tables in the database, optionally including the system tables.getType()
Get the database type.getTypeDef
(String p_name) Get an individual type definition in the database by name.Get a set of all of the type definitions in the database.getTypeDefs
(boolean p_refresh) Get a set of all of the type definitions in the database.getUsers
(BBjAdminDatabase.UserType p_type) Get the set of users of a specified type.Get an individual view in the database by name.getViews()
Get a set of all of the views in the database.void
grant
(List<BBjAdminPrivilege> p_privileges) Grants the specified list of privileges for this database.boolean
isUserProperty
(String p_property) Returns true if the specified property is considered a user property which means it is not a standard built-in property for databases.boolean
removeTableSanityMessage
(String p_sanityId) Removes the specified alert message from the database sanity check table.void
removeUser
(BBjAdminDatabase.UserType p_type, String p_user) Remove a single user of a specified type.resolveGlobals
(String p_string) Takes the specified string and resolves any references to global values that are defined in this database definition.void
revoke
(List<BBjAdminPrivilege> p_privileges) Revokes the specified list of privileges from this database.void
setAccessPolicy
(BBjAdminDatabase.AccessPolicy p_policy) Set the current access policy.void
setDateHandlers
(BBjAdminSet<BBjAdminDatabase.DateHandler> p_handlers) Set the set of date handlers.void
setPrivileges
(int p_objectType, String p_objectId, BBjAdminList<BBjAdminPrivilege> p_privileges) Convenience method to allow efficient setting of a large group of permissions in a single API call.void
setType
(BBjAdminDatabase.DatabaseType p_type) Set the database type.void
setUsers
(BBjAdminDatabase.UserType p_type, Set<String> p_users) Set all of the users of a specified type.void
terminateAnalysisJobs
(String p_database) Suspends and removes all currently running table analysis jobs for the specified database.Takes the specified database and uses an online copy job to update its data files to match the definition in the newly specified database.Methods inherited from interface com.basis.api.admin.BBjAdminCommitPropertyWriter
getChangedProperties, getClearedProperties, getOriginalProperties
Methods inherited from interface com.basis.api.admin.BBjAdminCommitWriter
commit, rollback
Methods inherited from interface com.basis.api.admin.BBjAdminPropertyReader
checkValueEqual, contains, contains, getBoolean, getDouble, getInt, getList, getLong, getProperties, getString, getType, getTypes, getValue
Methods inherited from interface com.basis.api.admin.BBjAdminPropertyWriter
addType, canAddNewProperties, canClear, clear, clearProperties, clearProperty, getReadOnly, hasChanged, isReadOnly, setBoolean, setDouble, setInt, setList, setLong, setProperties, setString, setValue
Methods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
DATABASE
Case-sensitive name of the database. Data type: String.- See Also:
-
TYPE
Type of the database. Data type: String.- See Also:
-
TIMEOUT
Timeout in milliseconds for database requests. This is the timeout for individual requests such as execute a query, fetch a single result, etc. Data type: Long.- See Also:
-
STATEMENT_TIMEOUT
Timeout in SECONDS for database file operations on statement execution and result set fetching.- See Also:
-
CREATE_TABLE_TYPE
Default type of file created when executing a CREATE TABLE statement.- See Also:
-
READ_ONLY
Sets the read only status for the entire database. If true, the database is read only. Note: This only applies to UPDATE, INSERT and DELETE statements. Stored procedures and triggers that may perform write operations will still be available for execution.- See Also:
-
READONLY
Sets the read only status for the entire database. If true, the database is read only. Note: This only applies to UPDATE, INSERT and DELETE statements. Stored procedures and triggers that may perform write operations will still be available for execution.- See Also:
-
ENFORCE_VARCHAR_LENGTH
If true, variable length columns will only allow values that fit within the defined length. For legacy purposes, by default, BBj allows values longer than the defined length of a VARCHAR. It is not uncommon for developers to define variable length columns as length 1 (a bad idea by the way, but supported). Setting this attribute to true will cause BBj to behave as most other DBMSs. If false, any length value can be specified for a VARCHAR as long as it does not exceed the maximum length of the record. Data type: Boolean.- See Also:
-
SPROC_DEBUG
If set to true, dot-step debugging is available when executing stored procedures. This setting should never be enabled in a live system as it causes terminal windows to open on the server which can cause unintended consequences to users of the system. See Debugging SPROCs and Triggers for more information.- See Also:
-
DEFAULT_NUMERIC_SCALE
- See Also:
-
ESQL_COLLATE
True/false whether to use collation order on ESQL tables or ASCII order.- See Also:
-
OPTIMIZED_DATE_COLUMNS
Deprecated.- See Also:
-
LOCALE
Database Locale as a IETF BCP 47 language tag as describes by the Java documentation for java.util.Locale.toLanguageTag().- See Also:
-
NUMERIC_STRIP_SPACES
If true, strip spaces from numeric field values before they are translated into numbers. For example "- 100" will be parsed as "-100".- See Also:
-
NUMERIC_EMPTY_STRING_AS_ZERO
If true, BBj SQL queries will return type NUMERIC values where the underlying data in the raw record (MKEYED, XKEYED, VKEYED, but NOT ESQL) as zero instead of NULL. This is a backward compatibility setting.- See Also:
-
OPTIMIZEDATECOLUMNS
If set to true, date columns will have optimization available. By default, optimization is disabled for date type columns except for equality optimization, This is because some date columns use underlying data types that are not sortable by ASCII value which is required for full optimization to occur. Only you will know if your data meets this criteria.- See Also:
-
AUTOCOMMIT
True if the default for the database should be to use autocommit. This will only matter on tables that support transactions such as ESQL files.- See Also:
-
CHARSET
Used to specify a specific character set used when processing records in the database.- See Also:
-
DATE_TYPE_DEFS
A comma-separated list of typedef/dateformat mappings. For example, assume a typedef named MY_DATE which is an integer containing a Julian number. You can specify a date format to be assigned to that typedef to process column values using that typedef as the date format specified. To include such in this value you would use: MY_DATE/Julian- See Also:
-
STRICT_KEY_CHECKING
Used by CREATE TABLE. If true, and if no primary key is specified, causes a primary key to be created using as many columns as can be fit into the 120-character maximum key length restriction. If this option is false, the user must explicitly specify a primary key when creating a table or an error will occur.- See Also:
-
STRICTKEYCHECKING
See STRICT_KEY_CHECKING- See Also:
-
ADVISORY_LOCKING
True/false whether to use advisory locking when accessing the data files for tables or not.- See Also:
-
ADVISORYLOCKING
See ADVISORY_LOCKING- See Also:
-
TRUNCATE_IF_TOO_LONG
If values returned from SQL queries are too long for the defined column, the value will be truncated. This setting is present for backward compatibility as BBx has traditionally allowed defining column lengths to be shorter than the actual data present in the data file. This can cause issues, especially with ODBC driver connections since ODBC applications use memory buffers and thus can cause memory overruns. By setting this to true, this ensures data will never be longer than the defined size in the data dictionary. However, there is potential for truncation so this defaults to false.- See Also:
-
TRUNCATEIFTOOLONG
See TRUNCATE_IF_TOO_LONG- See Also:
-
DICTIONARY
Full path to the data dictionary files (*.1 files for legacy databases, and the *.DD files for enhanced)- See Also:
-
DATA
Full path to the DATA global variable which is a standard variable used in table data file path specifications to avoid hard-coding paths into the database definition. For example, the ChileCompany database has a CUSTOMER table with a data file named CUSTOMER. The path to that data file is defined as (DATA)CUSTOMER. Specifying a value for DATA to be /usr/local/basis/demos/data/ will then use /usr/local/basis/demos/data/CUSTOMER when it needs to open that data file. It's important to include the trailing slash.- See Also:
-
ACCESS_POLICY
The access policy for this database. Valid values are DENY, RO, RW, and ALL. DENY means all users are denied access unless explicitly granted access by being added to the list in the RW_USERS or RO_USERS properties (see those properties for details). If this access policy is set to RO, then all users will have a minimum of read-only access to the database unless they are granted additional access by being added to the RW_USERS list. The ALL setting refers to database admin permissions. This is almost never used in a production DB since this would allow all users admin capabilities.- See Also:
-
REMOTE_ACCESS_POLICY
This is another layer of access that refers specifically to connections coming from machines other than the local machine. The settings work the same as ACCESS_POLICY except that they refer to remote connections.- See Also:
-
ADMIN_USERS
Comma-separated list of usernames who have admin privileges on the database. Users with this privlege (when using legacy permissions) can create/alter/drop tables and write to any table in the database, assuming they aren't limited by OS level file permissions.- See Also:
-
ADMINUSERS
See ADMIN_USERS- See Also:
-
RW_USERS
Comma-separated list of users who have read-write access to the database. Make sure to see ACCESS_POLICY for details on how the permissions work. There are important caveats.- See Also:
-
RWUSERS
See RW_USERS- See Also:
-
RO_USERS
Comma-separated list of users who have read-only access to the database. Make sure to see ACCESS_POLICY for details on how the permissions work. There are important caveats.- See Also:
-
ROUSERS
See RO_USERS- See Also:
-
REMOTE_RO_USERS
Comma-separated list of users who have read-only access to the database from remote machines. Make sure to see REMOTE_ACCESS_POLICY for details on how the permissions work. There are important caveats.- See Also:
-
REMOTE_RW_USERS
Comma-separated list of users who have read-write access to the database from remote machines. Make sure to see REMOTE_ACCESS_POLICY for details on how the permissions work. There are important caveats.- See Also:
-
REMOTE_DENY_USERS
Comma-separated list of users who have been explicitly denied access to the database.- See Also:
-
REMOTE_WHITELIST
Comma-separated list of IP address/hostnames that should NOT be treated as "remote" but rather, follow the permissions defined for local connections.- See Also:
-
TXN_ISOLATION
Default transaction isolation level. See java.sql.Connection for transaction isolation levels and their meanings. This level is only applicable to ESQL tables.- See Also:
-
AUTO_ANALYZE
See AUTO_ANALYZE_TABLES- See Also:
-
AUTO_ANALYZE_TABLES
True/false whether to allow BBjServices to automatically run table analysis when it deems appropriate. The main downside to leaving this enabled is that depending on the usage of some tables, it may run more often than desirable. That won't impact results, but it may bog down the server if it runs too often.- See Also:
-
OBJECT_LEVEL_PERMISSIONS
True/false to enable object level permissions. See BBj documentation for complete details. Default value is false.- See Also:
-
DEFAULT_DATE_TYPEDEF
- See Also:
-
DEFAULT_DATE_FORMAT
- See Also:
-
FULL_FEATURED_CREATE_VIEW
True/false to enable/disable creation of views using the "new" format. In older version of BBj, views were created by placing various parts of the SQL query into different files which limited the complexity of the queries views could use. The new format allows arbitrarily complex views to be created. The default is true. This should almost never be disabled if the setting is available.- See Also:
-
SPROC_RUN_AS_USER
True/false whether stored procedures should be run as the system user or as the user who connected to the database.- See Also:
-
SPROC_CLASSPATH
Alternate classpath to use for stored procedure interpreters if the default classpath is not desireable.- See Also:
-
SQL_FACTORY
BBjSQLFactory implementation class (including package) used to provide custom scalar/group functions accessible by this database. See the Custom Scalar/Group Functions documentation for complete details.- See Also:
-
SQL_FACTORY_SSCP
Session Specific Classpath (SSCP) containing reference to the JAR used to provide custom scalar/group functions accessible by this database. See the Custom Scalar/Group Functions documentation for complete details.- See Also:
-
HANDLE_VARIABLE_LENGTH_PADDED_VALUES
NOTE: This is a bit of an unusual setting. Please read carefully and also take a look at the referenced Bugzilla nunmbers to understand the issue completely. This setting was added to handle two opposing fixes. See Bugzilla 30228 and 29221. We can't support both fixes at the same time so we have this config option. The default will always return correct results but may be slow. The "correct" method may return results that people may perceive to be incorrect, but optimization is ideal and the results are actually technically correct.- See Also:
-
LINKED_DRIVER
Property used by linked database configurations to indicate the JDBC driver class.- See Also:
-
LINKED_URL
Property used by linked database configurations to indicate the URL used to connect to the database.- See Also:
-
LINKED_SHOULD_RESOLVE_GLOBALS
Property used by linked database configurations to indicate whether it should resolve any globals used.- See Also:
-
LINKED_USER
Property used by linked database configurations to indicate the user used to connect to the database.- See Also:
-
LINKED_PASSWORD
Property used by linked database configurations to indicate the password used to connect to the database. This will be encrypted when written to the config.ini file.- See Also:
-
LINKED_CONNECT_PROPERTIES
Comma separated list of name=value pairs to be used at connect time.- See Also:
-
LOGLEVEL
- See Also:
-
LOGFILE
Deprecated.- See Also:
-
DATE_COLUMNS_SORTED
Deprecated.- See Also:
-
ANALYSIS_FILTER_NONE
static final int ANALYSIS_FILTER_NONE- See Also:
-
ANALYSIS_FILTER_NO_OVERLAPS
static final int ANALYSIS_FILTER_NO_OVERLAPS- See Also:
-
ANALYSIS_FILTER_UNINDEXED_ONLY
static final int ANALYSIS_FILTER_UNINDEXED_ONLY- See Also:
-
ANALYSIS_FILTER_NO_SINGLES
static final int ANALYSIS_FILTER_NO_SINGLES- See Also:
-
EXPORT_FORMAT_JSON
static final int EXPORT_FORMAT_JSONUsed with the export() method. Exports the data in a JSON format.- See Also:
-
EXPORT_FORMAT_HTML
static final int EXPORT_FORMAT_HTMLUsed with the export() method. Exports the data in a human-readable, nicely formatted set of HTML files.- See Also:
-
EXPORT_FORMAT_SQL
static final int EXPORT_FORMAT_SQLUsed with the export() method. Exports the data as a series of SQL CREATE/ALTER statements.- See Also:
-
-
Method Details
-
getUsers
Get the set of users of a specified type.- Parameters:
p_type
- Type of users.- Throws:
BBjAdminException
-
setUsers
Set all of the users of a specified type.- Parameters:
p_type
- Type of users.p_users
- Set of users.- Throws:
BBjAdminException
-
addUser
Add a single user of a specified type.- Parameters:
p_type
- Type of user.p_user
- User name to add.- Throws:
BBjAdminException
-
removeUser
Remove a single user of a specified type.- Parameters:
p_type
- Type of user.p_user
- User name to remove.- Throws:
BBjAdminException
-
getAccessPolicy
Get the current access policy.- Throws:
BBjAdminException
-
setAccessPolicy
Set the current access policy.- Parameters:
p_policy
- Policy to set.- Throws:
BBjAdminException
-
getType
Get the database type.- Throws:
BBjAdminException
-
setType
Set the database type.- Parameters:
p_type
-- Throws:
BBjAdminException
-
getDateHandlers
Get the set of date handlers.- Throws:
BBjAdminException
-
setDateHandlers
Set the set of date handlers.- Parameters:
p_handlers
-- Throws:
BBjAdminException
-
createDateHandler
Create a new date handler. It has no effect until it is set and committed.- Throws:
BBjAdminException
-
getTables
Get a set of all of the tables in the database, optionally including the system tables.- Parameters:
p_includeSystemTables
- Should system tables be included in the set?- Throws:
BBjAdminException
-
getTablesSimpleInfo
BBjAdminSet<BBjAdminSimpleTableInfo> getTablesSimpleInfo(boolean p_includeSystemTables) throws BBjAdminException Get a set of all of the tables in the database, optionally including the system tables. This is different than the getTables() method in that it returns very quick and efficient informational objects. These objects don't have column or index info, only table info. Also, there are no methods for committing changes to the objects. They cut out the network communication used for calling the various set and get methods. This method is best used when you just need a list of tables with basic info.- Parameters:
p_includeSystemTables
- Should system tables be included in the set?- Throws:
BBjAdminException
-
getTableNames
BBjAdminSet<String> getTableNames(boolean p_includeSystemTables, boolean p_refresh) throws BBjAdminException Returns a list of the table names available in the database sorted alphabetically. This is a much more efficient method than calling getTables() as it only retrieves the table names without all the additional table information. Specifying true for p_refresh will cause the cache to be refreshed with the information from disk. Otherwise, if the list of tables is already available, it will pull the data from the cache which can be even more efficient.- Parameters:
p_includeSystemTables
- Whether it should include the system tables or not.p_refresh
- Whether it should refresh the internal table name cache list.- Returns:
- BBjAdminSet containing a list of table names in alphabetical order.
- Throws:
BBjAdminException
-
getTable
Get an individual table in the database by name.- Parameters:
p_table
-- Throws:
BBjAdminException
-
getTable
BBjAdminTable getTable(String p_table, boolean p_designMode, boolean p_skipAnalysis) throws BBjAdminException Get an individual table from the database. Indicate whether you want it to get the indexes from the data file or from the dictionary.- Parameters:
p_table
- Name of the table.p_designMode
- Tells server to get indexes and possibly other table information from the data dictionary only. Setting to false means that it may bypass the data dictionary info all together if it is able to derive index information from the file key structure alone.p_skipAnalysis
- Causes it to skip any automatic table analysis.- Throws:
BBjAdminException
-
createTable
Create an empty BBjAdminTable object to be used for table creation.- Throws:
BBjAdminException
-
getViews
Get a set of all of the views in the database.- Throws:
BBjAdminException
-
getView
Get an individual view in the database by name.- Throws:
BBjAdminException
-
createView
Create an empty BBjAdminView object to be used for view creation.- Parameters:
p_name
-- Throws:
BBjAdminException
-
createView
Create an empty BBjAdminView object to be used for view creation.- Throws:
BBjAdminException
-
dropView
Drop a single view.- Parameters:
p_view
-- Throws:
BBjAdminException
-
getProcedures
Get a set of all of the procedures in the database.- Throws:
BBjAdminException
-
getProcedure
Get an individual procedure in the database by name.- Parameters:
p_name
- Name of the procedure.- Throws:
BBjAdminException
-
createProcedure
Create an empty BBjAdminProcedure object to be used for procedure creation.- Parameters:
p_name
- Name of the new procedure.- Throws:
BBjAdminException
-
createProcedure
Create an empty BBjAdminProcedure object to be used for procedure creation.- Throws:
BBjAdminException
-
dropProcedure
Drop a single procedure.- Parameters:
p_name
-- Throws:
BBjAdminException
-
dropProcedure
Drop a single procedure and also remove the source code file.- Parameters:
p_name
-- Throws:
BBjAdminException
-
getTypeDefs
Get a set of all of the type definitions in the database. This does NOT refresh the list of type definitions if they are currently cached.- Throws:
BBjAdminException
-
getTypeDefs
Get a set of all of the type definitions in the database. Specify true for p_refresh in order- Parameters:
p_refresh
- Whether it should refresh the list of type definitions if there are any currently cached.- Throws:
BBjAdminException
-
getTypeDef
Get an individual type definition in the database by name.- Parameters:
p_name
- Name of typedef.- Throws:
BBjAdminException
-
createTypeDef
Create an empty BBjAdminTypeDef object to be used for type definition creation.- Parameters:
p_name
- Name of typedef.- Throws:
BBjAdminException
-
dropTable
Drop a single table. Optionally you can tell it to also remove the data file for the table as well.- Parameters:
p_name
- Name of the table to drop.p_removeFiles
- True if the data file for the table should also be removed. This includes .trigger files. Note: .sync and .textsearch files used for FULLTEXT index files will be removed regardless of whether this setting is true or false. If you do not want the FULLTEXT index files removed then use the other dropTable() method taking the additional p_removeFulltextFiles parameter.- Throws:
BBjAdminException
-
dropTable
void dropTable(String p_name, boolean p_removeFiles, boolean p_removeFulltextFiles) throws BBjAdminException Drop a single table. Optionally you can tell it to also remove the data file and/or FULLTEXT index files for the table as well.- Parameters:
p_name
-p_removeFiles
- True if the data file for the table should also be removed. This includes .trigger files. Note: .sync and .textsearch files used for FULLTEXT index files will be only removed if the p_removeFulltextFiles parameter is true.p_removeFulltextFiles
- True if the .sync and .textsearch files used for FULLTEXT index should be removed.- Throws:
BBjAdminException
-
dropTypeDef
Drop a single typedef.- Parameters:
p_name
-- Throws:
BBjAdminException
-
getSequences
Get a set of all of the sequences in the database.- Throws:
BBjAdminException
-
getSequence
Get an individual sequence in the database by name.- Parameters:
p_name
- Name of the sequence.- Throws:
BBjAdminException
-
createSequence
Create an empty BBjAdminSequence object to be used for sequence creation.- Parameters:
p_name
- Name of the sequence.- Throws:
BBjAdminException
-
dropSequence
Drop a single sequence.- Parameters:
p_name
-- Throws:
BBjAdminException
-
getQueryAnalysis
Get a number of suggested indexes from query analysis.- Parameters:
p_count
- Maximum number of suggested indexes to get.- Throws:
BBjAdminException
-
getQueryAnalysis
BBjAdminList<BBjAdminQueryAnalysis> getQueryAnalysis(String p_tableFilter, int p_filterFlag, int p_count) throws BBjAdminException Get a filtered number of suggested indexes from query analysis.- Parameters:
p_count
- Maximum number of suggested indexes to get.- Throws:
BBjAdminException
-
getDictionaryMigrationInfo
BBjAdminDictionaryMigrationInfo getDictionaryMigrationInfo(String p_newDictionary, String p_dataLocation) throws BBjAdminException Returns information regarding the changes that may want to be made to the "new" dictionary when a call is made to updateDatabase(). The information in this object will tell what indexes and columns should be brought from the old dictionary to the new one, what SPROCs to bring forward, etc.- Parameters:
p_newDictionary
- Location of new data dictionary definition that the database should match after update.p_dataLocation
- Location where the table data files should be placed by the copy job during update.- Throws:
BBjAdminException
-
updateDatabase
Takes the specified database and uses an online copy job to update its data files to match the definition in the newly specified database. All of the updated files will be placed in the p_destDir directory. The new dictionary will also be updated to match any information specified in the DictionaryMigrationInfo.- Parameters:
p_info
-- Throws:
BBjAdminException
-
resolveGlobals
Takes the specified string and resolves any references to global values that are defined in this database definition. For example, (DATA) would be resolved to the path specified for the data files in the database.- Parameters:
p_string
- String to be resolved.- Throws:
BBjAdminException
-
terminateAnalysisJobs
Suspends and removes all currently running table analysis jobs for the specified database.- Parameters:
p_database
- Name of database to suspend all jobs for.- Throws:
BBjAdminException
-
getPrivileges
BBjAdminList<BBjAdminPrivilege> getPrivileges(String p_userFilter, Integer p_privilegeType, Integer p_objectType, String p_objectIdFilter, String p_sortString) throws BBjAdminException Returns a list of all the privileges for the specified filter criteria. Use the p_sortString parameter to specify the order in which the privileges will be arranged. This operation reads all info from the disk each time.- Parameters:
p_userFilter
- Use an SQL LIKE format filter value for the user or role name.p_privilegeType
-p_objectType
-p_objectIdFilter
- Use an SQL LIKE format filter value for the object IDp_sortString
- Specify column values and separate by commas. Valid values are DD_PRIVILEGE_TYPE, DD_OBJECT_TYPE, DD_OBJECT_ID, DD_USER_ID, DD_ROLE_ID, DD_WITH_GRANT- Throws:
BBjAdminException
-
setPrivileges
void setPrivileges(int p_objectType, String p_objectId, BBjAdminList<BBjAdminPrivilege> p_privileges) throws BBjAdminException Convenience method to allow efficient setting of a large group of permissions in a single API call. Basically it will look through the list of permissions and grant or revoke permissions as necessary to match the list. Use caution as this updates the entire permission set for a particular object in the database.- Parameters:
p_objectType
-p_objectId
-p_privileges
-- Throws:
BBjAdminException
-
grant
Grants the specified list of privileges for this database.- Parameters:
p_privileges
-- Throws:
BBjAdminException
-
revoke
Revokes the specified list of privileges from this database.- Parameters:
p_privileges
-- Throws:
BBjAdminException
-
createPrivilege
BBjAdminPrivilege createPrivilege()Returns a new instance of an empty BBjAdminPrivilege object ready to be set for granting or revoking privileges. -
createRole
Creates a new role on the database used for grouping multiple users for the purpose of granting and revoking prvileges.- Parameters:
p_roleName
-- Throws:
BBjAdminException
-
createRole
Creates a new role on the database used for grouping multiple users for the purpose of granting and revoking prvileges.- Parameters:
p_roleName
-p_comments
-- Throws:
BBjAdminException
-
dropRole
Drops the specified role from the database.- Parameters:
p_roleName
-- Throws:
BBjAdminException
-
getRoles
Returns a list of all the names of the roles currently in the database.- Throws:
BBjAdminException
-
getRoleMembers
Returns a list of the users who are currently part of the specified role.- Parameters:
p_roleName
-- Throws:
BBjAdminException
-
executeSQL
Executes an SQL statement or list of SQL statements separated by semi-colons.- Parameters:
p_sql
-- Throws:
BBjAdminException
-
cleanupCaches
void cleanupCaches()Called to explicitly clear out any cached data such as open connections to the database that were created internally by executing SQL statements on the database through calls to executeSQL(). If you want to clean things up before final cleanup, call this method. -
getSanity
Returns objects that contain information about the "sanity" of a particular database table. During table analysis, sanity is checked and if there are issues found with a table, information is logged to the DD_SANITY table about the nature of the problem. This is designed to help the administrator find problems in their database before customers do.- Throws:
BBjAdminException
-
getSanity
Returns objects that contain information about the "sanity" of a particular database table. During table analysis, sanity is checked and if there are issues found with a table, information is logged to the DD_SANITY table about the nature of the problem. This is designed to help the administrator find problems in their database before customers do.- Parameters:
p_table
- Name of the table to get the sanity information for.- Throws:
BBjAdminException
-
removeTableSanityMessage
Removes the specified alert message from the database sanity check table.- Parameters:
p_sanityId
-- Throws:
BBjAdminException
-
getQueryData
Returns a list of BBjAdminQueryData objects, one for each table that matches the table filter criteria.- Parameters:
p_tableFilter
-- Throws:
BBjAdminException
-
getDescriptiveProperties
Used primarily by GUI applications like the Enterprise Manager to dynamically generate an admin UI. To get property values for general purposes, you should call the getXXX() methods.- Returns:
- BBjAdminList containing BBjAdminProperty objects for each available property.
- Throws:
BBjAdminException
-
getMetadataDefinition
Returns the definition for all the metadata in this database which includes database metadata, table, view, SPROC, etc.- Throws:
BBjAdminException
-
isUserProperty
Returns true if the specified property is considered a user property which means it is not a standard built-in property for databases.- Parameters:
p_property
-- Throws:
BBjAdminException
-
getStandardPropertyNames
- Throws:
BBjAdminException
-
close
void close()Should be called when you are completely done with this instance to cleanup resources used on the server side. -
getConnections
Returns a list of all current connections made to this database. The connection info contains information such as the client's IP address, user, connect time, type of connection, number of statements open, number of transactions open (if transactional), etc.- Returns:
- List of open connections on this database.
- Throws:
BBjAdminException
-
export
void export(String p_location, int p_format, List<String> p_tables, List<String> p_views, List<String> p_sprocs, List<String> p_types, List<String> p_sequences, List<String> p_users, List<String> p_roles) throws BBjAdminException Exports the database to the specified location in the specified format. Optionally, you may provide a list of each type of object to be exported such as table, views, SPROCs, etc.- Parameters:
p_location
-p_format
-p_tables
- Null for all tables. Empty List for no tables. Populate the list with names of tables to include.p_views
- Null for all views. Empty List for no views. Populate the list with names of views to include.p_sprocs
- Null for all SPROCs. Empty List for no SPROCs. Populate the list with names of SPROCs to include.p_types
- Null for all type definitions. Empty List for no type definitions. Populate the list with names of type definitions to include.p_sequences
- Null for all sequences. Empty List for no sequences. Populate the list with names of sequences to include.p_users
- Null for all users. Empty List for no users. Populate the list with names of users to include.p_roles
- Null for all roles. Empty List for no roles. Populate the list with names of roles to include.- Throws:
BBjAdminException
-