|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.0) E13403-08 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Database
Provides a interface for accessing a database. This extension of
DBObjectProvider
includes methods specific to a connection with
a live database. A DBObjectProvider
may connect to a different
object store but a Database
will always have an underlying
java.sql.Connection
object.
To retrieve a Database
implementation for a given
Connection
use the DatabaseFactory
.
DBObjectProvider
,
DatabaseFactory
Field Summary | |
---|---|
static long |
FOUR_GIG
Constant: size for four gigabytes |
static java.lang.String |
GENERIC_JDBC_DATABASE
Type for a generic JDBC database. |
static java.lang.String |
SOURCE_TYPE_BODY
For source nodes with more than one type of source |
static java.lang.String |
SOURCE_TYPE_SPEC
For source nodes with more than one type of source |
static long |
TWO_GIG
Constant: size for two gigabytes |
Fields inherited from interface oracle.javatools.db.DBObjectProvider |
---|
CREATE_PRIVILEDGE, DELETE_PRIVILEDGE, MODIFY_PRIVILEDGE, NEW_FROM_TEMPLATE_TYPE |
Method Summary | |
---|---|
boolean |
canRestrictSchemaList()
Whether this provider supports restricting the list of schemas to those with visible objects. |
void |
close()
Closes the Database Connection (and the supplied JDBC Connection). |
boolean |
exists(java.lang.String type,
java.lang.String schema,
java.lang.String objectName)
Checks for existance of a schema object named objectName . |
java.sql.Connection |
getConnection()
Gets the JDBC connection associated with this database. |
java.sql.Connection |
getConnection(boolean reconnect)
Gets the JDBC connection associated with this database. |
java.lang.String |
getConnectionName()
Retrieves the name for the Connection associated with this Database in whichever connection store it is stored in. |
java.lang.String |
getConnectionStore()
Retrieves the connection store the Connection associated with this Database is stored in. |
java.lang.String |
getDatabaseSource(java.lang.String objectType,
Schema schema,
java.lang.String objectName)
Retrieves the source for an object in the database. |
java.lang.String |
getDatabaseSource(java.lang.String objectType,
Schema schema,
java.lang.String objectName,
java.lang.String sourceType)
Retrieves the source for an object in the database. |
java.lang.String |
getDatabaseType()
Gets the type of database. |
int |
getDatabaseVersion()
Gets the version of the database for the api implementation. |
java.lang.String |
getIdentifierQuoteString()
Returns the String to use to quote SQL identifiers with |
java.lang.String |
getQualifiedName()
Retrieves a qualified name containing the connection store and connection name. |
java.lang.String |
getUserName()
Retrieves the username used to connect to the database |
boolean |
hasTransaction()
Tests whether there is currently a "transaction" open on the underlying java.sql.Connection. |
boolean |
isConnectionAlive()
Tests whether the connection underneath this Database is "alive" - i.e. |
java.lang.Boolean |
isConnectionClosed(java.sql.SQLException sqe)
Tests whether the given SQLException (assumed to have come from the connection of this db) is the result of the connection being closed. |
boolean |
isObjectValid(java.lang.String objectType,
java.lang.String schema,
java.lang.String objectName)
Determines whether the specified database object is in a valid state. |
boolean |
supportsDebugging()
Whether this database instance supports JDWP debugging. |
void |
testSQLStatement(java.lang.String sql)
Tests that the given SQL executes against the database. |
Field Detail |
---|
static final java.lang.String GENERIC_JDBC_DATABASE
getDatabaseType()
,
Constant Field Valuesstatic final long TWO_GIG
static final long FOUR_GIG
static final java.lang.String SOURCE_TYPE_SPEC
static final java.lang.String SOURCE_TYPE_BODY
Method Detail |
---|
java.sql.Connection getConnection()
Code should, where possible, use one of the wrapper classes in
oracle.javatools.db.execute
to use a Connection and not need to
directly call this method.
getConnection(boolean)
java.sql.Connection getConnection(boolean reconnect) throws DBException
isConnectionAlive()
.
reconnect
- whether to try and reconnect to the db
DBException
- wrapping a SQLException if there is a problem
reconnectingboolean isConnectionAlive()
Note the implementation of this is database specific - a positive can be assumed true but a negative could be incorrect.
getConnection(boolean)
java.lang.Boolean isConnectionClosed(java.sql.SQLException sqe)
If the method returns null
it indicates that the API cannot
identify the cause of any SQLException, either because:
If this method is called with a null parameter value, it should return
null
if SQLException identification isn't supported, or
Boolean.FALSE
if it is.
sqe
- the exception to test (this can be null to test if SQLException
identification is supported).
boolean hasTransaction()
Note the implementation of this is database specific - a positive can be assumed true but a negative could be incorrect.
java.lang.String getConnectionName()
getConnectionStore()
,
getQualifiedName()
java.lang.String getConnectionStore()
getQualifiedName()
java.lang.String getQualifiedName()
If this connection has no connection store associated with it, this method will simply return the encoded connection name.
getConnectionStore()
,
getConnectionName()
void close()
java.lang.String getUserName() throws DBException
DBException
java.lang.String getDatabaseType()
DatabaseMetaData.getDatabaseProductName()
int getDatabaseVersion()
boolean exists(java.lang.String type, java.lang.String schema, java.lang.String objectName)
objectName
.
objectName
- The name of the schema object.
true
if the object exists, false
otherwise.java.lang.String getIdentifierQuoteString()
String
to use to quote SQL identifiers with
getIdentifierQuoteString
in interface DBObjectProvider
DatabaseMetaData.getIdentifierQuoteString()
boolean isObjectValid(java.lang.String objectType, java.lang.String schema, java.lang.String objectName)
schema
- the name of the schema containing the objectobjectName
- the name of the objectobjectType
- the type of the object.boolean supportsDebugging()
false
.
true
if JDWP debugging is supported against this
database, false
otherwisejava.lang.String getDatabaseSource(java.lang.String objectType, Schema schema, java.lang.String objectName) throws DBException
null
.
objectType
- The type of object for which the source is neededschema
- The Schema
containing the objectobjectName
- The name of the object
DBException
- if an error occurs fetching the sourcejava.lang.String getDatabaseSource(java.lang.String objectType, Schema schema, java.lang.String objectName, java.lang.String sourceType) throws DBException
null
. This method combines spec and
body for those source types that support both.
objectType
- The type of object for which the source is neededschema
- The Schema
containing the objectobjectName
- The name of the objectsourceType
- In the case of types that have more than one source,
the type of source required. Can be Database.SOURCE_TYPE_SPEC or
Database.SOURCE_TYPE_BODY. If null, the default of body is selected.
DBException
- if an error occurs fetching the sourceboolean canRestrictSchemaList()
void testSQLStatement(java.lang.String sql) throws InvalidSQLException, DBException
sql
- the sql to test
InvalidSQLException
- if the sql doesn't execute (because the syntax
is invalid etc).
DBException
- for any other error in executing the sql
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.0) E13403-08 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |