Extension SDK

oracle.jdeveloper.cm.ds.db
Interface Database

All Known Implementing Classes:
JdbcDatabase

public interface Database

Database - The interface between the JDeveloper code and a data source. The only current implementation of this class is JdbcDatabase

See Also:
JdbcDatabase

Field Summary
static int DATABASE_TYPE_GENERIC
          Constant: Generic database support
static int DATABASE_TYPE_ORACLE
          Constant: Oracle support
static int DATABASE_TYPE_ORACLELITE
          Constant: Oracle Lite support
 
Method Summary
 void close()
          Close the Database Connection (and the supplied JDBC Connection)
 java.sql.ResultSet executeQuery(java.lang.String sqlStmt)
          Get a ResultSet from a query
This function may also set data returned by getLastResultString() or getLastErrorText().
 boolean exists(java.lang.String schema, java.lang.String type, java.lang.String objectName)
          Checks for existance of a schema object named objectName.
 java.sql.Connection getConnection()
          Get the JDBC connection associated with this database
 java.lang.String getConnectionName()
          Get the Connection Manager connection name
 int getDatabaseType()
          Get the type of database.
 int getFullVersion()
          Get the full version as in int.
 java.lang.String getFullVersionString()
          Get the full version as in String.
 java.lang.String getIdentifierQuoteString()
          Returns the String to use to quote SQL identifiers with
 java.util.List getJavaObjects(int dbObjectType, java.lang.String userName, java.lang.String classPath, int depth)
          Gets a list of the java objects in the database for a given username and object type under a given classpath.
 java.lang.String getLastErrorText()
          Get the last error text returned by executeQuery
 java.lang.String getLastResultString()
          Gets the last message returned by executeQuery when no ResultSet was returned.
 int getMajorVersion()
          Get the first digit of the full version as in int.
 java.util.List getObjects(int dbObjectType, java.lang.String userName)
          Gets a list of the database objects for a given username and object type
 java.util.List getObjects(int dbObjectType, java.lang.String userName, java.lang.String ref)
          Gets a list of the database objects for a given username and object type associated with the refobject.
 java.util.Iterator getObjectTypes()
          Get the types of database objects supported.
 Sequence getSequence(java.lang.String schema, java.lang.String sequenceName)
          Creates a Sequence datamodel.
 java.lang.Object getSource(int dbObjectType, java.lang.String userName, java.lang.String objectName)
          Gets the source of a stored program unit
 Synonym getSynonym(java.lang.String schema, java.lang.String synonymName)
          Creates a Synonym datamodel.
 int getSynonymType(java.lang.String schema, java.lang.String synonymName)
          Gets the underlying type of a Synonym.
 Table getTable(java.lang.String schema, java.lang.String tableName)
          Creates a Table datamodel.
 long getTimestamp(java.lang.String schema, java.lang.String type, java.lang.String objectName)
          Gets the timestamp of a PL/SQL Subprogram
 java.lang.String getUniqueObjectName(java.lang.String schema, int objectType, java.lang.String baseName)
          Retrieves a unique object name
 boolean isObjectValid(java.lang.String schema, java.lang.String objectName, int objectType)
          Determines whether the specified database object is in a valid state.
 boolean isUserPrivileged()
          Determine if current user has privs on the DBA data dictionary views.
 boolean isValidName(java.lang.String objectName)
          Checks the whether objectName is a valid name for a schema Object.
 boolean supportsDebugging()
          Determines whether this database instance supports debugging.
 

Field Detail

DATABASE_TYPE_GENERIC

public static final int DATABASE_TYPE_GENERIC
Constant: Generic database support

See Also:
Constant Field Values

DATABASE_TYPE_ORACLE

public static final int DATABASE_TYPE_ORACLE
Constant: Oracle support

See Also:
Constant Field Values

DATABASE_TYPE_ORACLELITE

public static final int DATABASE_TYPE_ORACLELITE
Constant: Oracle Lite support

See Also:
Constant Field Values
Method Detail

getConnection

public java.sql.Connection getConnection()
Get the JDBC connection associated with this database

Returns:
Connection - The JDBC Connection owned by this database object.

See Also:
Connection

getConnectionName

public java.lang.String getConnectionName()
Get the Connection Manager connection name

Returns:
String - The name of the JDeveloper Connection Manager connection owned by this database object.

See Also:
ConnectionManager

getDatabaseType

public int getDatabaseType()
Get the type of database. This method uses JDBC metadata to determine the database type. The possible types are:

See Also:
DATABASE_TYPE_GENERIC, DATABASE_TYPE_ORACLE, DATABASE_TYPE_ORACLELITE, java.sql.DatabaseMetaData.getDatabaseProductName, Database, JdbcDatabase

getMajorVersion

public int getMajorVersion()
Get the first digit of the full version as in int. Note, this only will work on Oracle databases.

Returns:
int the major version number

getFullVersionString

public java.lang.String getFullVersionString()
Get the full version as in String. Note, this only will work on Oracle databases.

Returns:
String the version number

getFullVersion

public int getFullVersion()
Get the full version as in int. Note, this only will work on Oracle databases.

Returns:
int the version number

getObjectTypes

public java.util.Iterator getObjectTypes()
Get the types of database objects supported.

Returns:
Iterator iterator for the list of types

getObjects

public java.util.List getObjects(int dbObjectType,
                                 java.lang.String userName)
Gets a list of the database objects for a given username and object type

Parameters:
dbObjectType - Type of object.
userName - schema to query

Returns:
List list of objects contained.

getObjects

public java.util.List getObjects(int dbObjectType,
                                 java.lang.String userName,
                                 java.lang.String ref)
Gets a list of the database objects for a given username and object type associated with the refobject. Example: getting all of the INDEX objects where the referenced Table is ref.

Parameters:
dbObjectType - Type of object.
userName - schema to query
ref - Object Referenced for the query.

Returns:
List list of objects contained.

getJavaObjects

public java.util.List getJavaObjects(int dbObjectType,
                                     java.lang.String userName,
                                     java.lang.String classPath,
                                     int depth)
Gets a list of the java objects in the database for a given username and object type under a given classpath.

Parameters:
dbObjectType - Type of object.
userName - schema to query
classPath - the portion of the classpath to include in the query

Returns:
List list of objects contained.

getSource

public java.lang.Object getSource(int dbObjectType,
                                  java.lang.String userName,
                                  java.lang.String objectName)
Gets the source of a stored program unit

Parameters:
dbObjectType - Type of stored program unit
userName - owning schema of the program unit
objectName - name of the program unit

Returns:
Object Full source of the program unit as a String, or BinaryResource with resources/class files.

close

public void close()
Close the Database Connection (and the supplied JDBC Connection)


getLastResultString

public java.lang.String getLastResultString()
Gets the last message returned by executeQuery when no ResultSet was returned.

Returns:
the text returned, or null if no text was returned.
See Also:
ResultSet, executeQuery(String)

executeQuery

public java.sql.ResultSet executeQuery(java.lang.String sqlStmt)
Get a ResultSet from a query
This function may also set data returned by getLastResultString() or getLastErrorText().

NOTE: The caller is responsible for closing the result set AND the statement associated with the result set.

Parameters:
sqlStmt - The SQL Statement to execute

Returns:
ResultSet of the returned rows or null if not a query or the query failed.
See Also:
getLastResultString(), getLastErrorText(), ResultSet.getStatement()

getLastErrorText

public java.lang.String getLastErrorText()
Get the last error text returned by executeQuery

Returns:
String the text of the error, or null if there was no error on the last execution of a SQL statement.

isUserPrivileged

public boolean isUserPrivileged()
Determine if current user has privs on the DBA data dictionary views. If this connection is not to an Oracle database, this method will also return false.

Returns:
true if user can select on the DBA_XXXX views, false otherwise

getTable

public Table getTable(java.lang.String schema,
                      java.lang.String tableName)
Creates a Table datamodel.

Returns:
Table datamodel of tableName

getSequence

public Sequence getSequence(java.lang.String schema,
                            java.lang.String sequenceName)
Creates a Sequence datamodel.

Returns:
Sequence datamodel of sequenceName

exists

public boolean exists(java.lang.String schema,
                      java.lang.String type,
                      java.lang.String objectName)
Checks for existance of a schema object named objectName.

Parameters:
objectName - The name of the schema object.
Returns:
true if the object exists, false otherwise.

isValidName

public boolean isValidName(java.lang.String objectName)
Checks the whether objectName is a valid name for a schema Object. This function will make all reasonable non-destructive tests, but is not guaranteed to be 100% accurate.

Parameters:
objectName - The name of the schema object.
Returns:
true if the name is valid, false otherwise.

getIdentifierQuoteString

public java.lang.String getIdentifierQuoteString()
Returns the String to use to quote SQL identifiers with

Returns:
the String to use to quote an SQL identifier, or an empty String "", if the underlying database does not support this functionality.
See Also:
DatabaseMetaData.getIdentifierQuoteString()

getTimestamp

public long getTimestamp(java.lang.String schema,
                         java.lang.String type,
                         java.lang.String objectName)
Gets the timestamp of a PL/SQL Subprogram


getSynonymType

public int getSynonymType(java.lang.String schema,
                          java.lang.String synonymName)
Gets the underlying type of a Synonym.


getSynonym

public Synonym getSynonym(java.lang.String schema,
                          java.lang.String synonymName)
Creates a Synonym datamodel.

Returns:
Synonym datamodel of synonymName, or null if the database does not support all the required functionality.

isObjectValid

public boolean isObjectValid(java.lang.String schema,
                             java.lang.String objectName,
                             int objectType)
Determines whether the specified database object is in a valid state.

Parameters:
schema - the name of the schema containing the object
objectName - the name of the object
objectType - the type of the object.
See Also:
DatabaseObjectType

supportsDebugging

public boolean supportsDebugging()
Determines whether this database instance supports debugging.


getUniqueObjectName

public java.lang.String getUniqueObjectName(java.lang.String schema,
                                            int objectType,
                                            java.lang.String baseName)
Retrieves a unique object name

Parameters:
schema - the schema to check
objectType - the type of object
baseName - the base name to use

Extension SDK

 

Copyright ©1997, 2003, Oracle. All rights reserved.