|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.udo.cs.miningmart.db.DbCore
edu.udo.cs.miningmart.db.DbCoreOracle
This class provides an access to an Oracle DBMS. It has only been tested with Oracle version 8.1.6. To compile this class, the Oracle JDBC driver package must be added to the classpath.
Field Summary | |
static java.lang.String |
ORACLE_TYPE_CHAR
The public constant indicating the Oracle Datatype CHAR |
static java.lang.String |
ORACLE_TYPE_DATE
The public constant indicating the Oracle Datatype DATE |
static java.lang.String |
ORACLE_TYPE_LONG
The public constant indicating the Oracle Datatype LONG |
static java.lang.String |
ORACLE_TYPE_NUMBER
The public constant indicating the Oracle Datatype NUMBER |
static java.lang.String |
ORACLE_TYPE_STRING
The public constant indicating the Oracle Datatype VARCHAR2 |
Fields inherited from class edu.udo.cs.miningmart.db.DbCore |
DBMS_ORACLE, DBMS_POSTGRES |
Constructor Summary | |
DbCoreOracle(java.lang.String url,
java.lang.String dbName,
java.lang.String user,
java.lang.String passwd,
M4InterfaceContext cal,
boolean isM4Schema)
The constructor of this class establishes a new database connection. |
Method Summary | |
boolean |
dropRelation(java.lang.String tableName)
Try to drop the table or view with the given name, if it exists. |
java.lang.String |
getAttributeForColumnNames()
Abstract method to be implemented by the subclasses. |
java.lang.String |
getAttributeForColumnTypes()
Abstract method to be implemented by the subclasses. |
java.lang.String |
getDatatypeName(java.lang.String m4RelDatatypeName,
int size)
This method returns the DBMS-dependent name of the datatype which the current DBMS uses to realize the given M4-Relational Datatype. |
short |
getDbms()
Indicates the DBMS used. |
java.lang.String |
getM4DatatypeName(java.lang.String dbmsDatatypeName)
This method returns the M4-Relational Datatype that corresponds to the given DBMS-dependent name of a datatype. |
protected long |
getNextM4SequenceValue(java.sql.Statement stmt)
|
java.util.Collection |
getPrimaryKeyColumnNames(java.lang.String dbObjectName)
Returns a Collection with the names of the DB columns that belong to the given table or view and form its primary key, if such a key is declared by SQL constraints in the DB. |
java.lang.String |
getSelectStringAllColumnsForDbObject(java.lang.String dbObjectName)
Abstract method to be implemented by the subclasses. |
java.lang.String |
getSelectStringAllTables()
Abstract method to be implemented by the subclasses. |
java.lang.String |
getSelectStringAllViews()
Abstract method to be implemented by the subclasses. |
java.lang.String |
getSelectStringColumnDataTypes(java.lang.String dbObjectName,
java.lang.String owner,
java.lang.String columnName)
This method returns the DBMS-dependent SQL command that returns the name of the datatype of the given column in the given table or view (which is owned by the given owner). |
java.lang.String |
getTableOrViewType(java.lang.String dbObjectName)
Returns one of the TYPE_... constants in the class edu.udo.cs.miningmart.m4.Columnset, or null if the given String is neither a table or view. |
java.util.Map |
getTablesReferencedBy(java.lang.String dbObjectName)
Returns a Map that maps every column of the given table that acts as a foreign key to the name of the table that it references. |
java.lang.String |
getTestQuery()
|
java.lang.String |
getUniqueRowIdentifier()
Abstract method to be implemented by the subclasses. |
protected void |
registerJDBC_Driver()
This method must be implemented by subclasses in order to use other JDBC drivers (for other DBMS, for example). |
protected void |
switchAutocommitOff(java.sql.Connection con)
Since the transaction mechanism may be different for different DBMS, use this method to implement the Autocommit handling. |
boolean |
tableExists(java.lang.String tableName)
Returns TRUE if a table (not a view) with the given name exists in the database. |
Methods inherited from class edu.udo.cs.miningmart.db.DbCore |
commitTransactions, createSQLFunction, createSqlIndex, createSQLView, executeDBProcedure, executeSingleValueSqlRead, executeSingleValueSqlReadL, executeSingleValueSqlReadL, executeSqlRead, executeSqlWrite, finalize, findDBMS, getCasePrintObject, hasOnlyForeignKeyColumns, rollback |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String ORACLE_TYPE_NUMBER
public static final java.lang.String ORACLE_TYPE_STRING
public static final java.lang.String ORACLE_TYPE_DATE
public static final java.lang.String ORACLE_TYPE_CHAR
public static final java.lang.String ORACLE_TYPE_LONG
Constructor Detail |
public DbCoreOracle(java.lang.String url, java.lang.String dbName, java.lang.String user, java.lang.String passwd, M4InterfaceContext cal, boolean isM4Schema) throws java.sql.SQLException
url
- Prefix of the database urldbName
- name of the databaseuser
- name of the database userpasswd
- password for the database usercal
- the CompilerAccessLogic
of the current thread. It is just needed
in order to reach the appropriate Print
-object for writing debug messagesisM4Schema
- is true
iff the connection refers to the M4 schema. Useful
to decide whether triggers need to be switched off etc.
java.sql.SQLException
edu.udo.cs.miningmart.m4.core.utils.DbCore#DbCore(String, String, String, String, CompilerAccessLogic, boolean)
Method Detail |
public short getDbms()
DbCore
getDbms
in class DbCore
DbCore.getDbms()
protected void registerJDBC_Driver() throws java.sql.SQLException
DbCore
registerJDBC_Driver
in class DbCore
java.sql.SQLException
DbCore.registerJDBC_Driver()
protected void switchAutocommitOff(java.sql.Connection con) throws java.sql.SQLException
DbCore
switchAutocommitOff
in class DbCore
java.sql.SQLException
DbCore#switchAutocommitOff()
protected long getNextM4SequenceValue(java.sql.Statement stmt) throws M4Exception
getNextM4SequenceValue
in class DbCore
stmt
- the Statement
to be used to execute the query
M4Exception
- if for some reason the sequence does not return a valueDbCore.getNextM4SequenceValue(Statement)
public java.lang.String getSelectStringAllTables()
DbCore
getSelectStringAllTables
in class DbCore
DbCore
public boolean tableExists(java.lang.String tableName) throws M4Exception
DbCore
tableExists
in class DbCore
tableName
- the table name
M4Exception
public java.lang.String getSelectStringAllViews()
DbCore
getSelectStringAllViews
in class DbCore
DbCore
public java.lang.String getSelectStringAllColumnsForDbObject(java.lang.String dbObjectName)
DbCore
getSelectStringAllColumnsForDbObject
in class DbCore
dbObjectName
- Name of a table or view in the business data schema
DbCore
public java.lang.String getSelectStringColumnDataTypes(java.lang.String dbObjectName, java.lang.String owner, java.lang.String columnName)
DbCore
getSelectStringColumnDataTypes
in class DbCore
dbObjectName
- Name of a table or view in the business data schemaowner
- Name of the owner of the table or view (can be null)columnName
- Name of the column whose datatype is returned
DbCore
public java.util.Collection getPrimaryKeyColumnNames(java.lang.String dbObjectName) throws java.sql.SQLException, DbConnectionClosed
getPrimaryKeyColumnNames
in class DbCore
dbObjectName
- the name of the given table or view
java.sql.SQLException
DbConnectionClosed
public java.util.Map getTablesReferencedBy(java.lang.String dbObjectName) throws java.sql.SQLException, DbConnectionClosed
getTablesReferencedBy
in class DbCore
dbObjectName
-
java.sql.SQLException
DbConnectionClosed
public java.lang.String getTableOrViewType(java.lang.String dbObjectName) throws java.sql.SQLException, DbConnectionClosed
getTableOrViewType
in class DbCore
dbObjectName
- name of a table or view
java.sql.SQLException
DbConnectionClosed
public java.lang.String getAttributeForColumnNames()
DbCore
getAttributeForColumnNames
in class DbCore
DbCore
public java.lang.String getAttributeForColumnTypes()
DbCore
getAttributeForColumnTypes
in class DbCore
DbCore
public java.lang.String getUniqueRowIdentifier()
DbCore
getUniqueRowIdentifier
in class DbCore
DbCore
public java.lang.String getDatatypeName(java.lang.String m4RelDatatypeName, int size)
DbCore
getDatatypeName
in class DbCore
m4RelDatatypeName
- name of the M4 Relational Datatypesize
- A size to be returned with the datatype, if the DBMS allows that.
For example, if the M4 Relational Datatype is NUMBER and length is 10,
then the return value will be the String "NUMBER(10)"
if the DBMS is Oracle. If this length is not positive, the datatype will be returned without
a size, in the example: "NUMBER". The DBMS may not allow lengths at all, in which case
also the datatype without a size is returned.
DbCore
public java.lang.String getM4DatatypeName(java.lang.String dbmsDatatypeName)
DbCore
getM4DatatypeName
in class DbCore
dbmsDatatypeName
- the name of the datatype in the underlying DBMS
DbCore
public boolean dropRelation(java.lang.String tableName) throws M4Exception
dropRelation
in class DbCore
tableName
- the name of the table to be dropped
M4Exception
public java.lang.String getTestQuery()
getTestQuery
in class DbCore
String
that can be used as a query to test the DB connection.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |