Package io.debezium.connector.oracle
Class OracleConnection
- java.lang.Object
-
- io.debezium.jdbc.JdbcConnection
-
- io.debezium.connector.oracle.OracleConnection
-
- All Implemented Interfaces:
AutoCloseable
public class OracleConnection extends JdbcConnection
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.debezium.jdbc.JdbcConnection
JdbcConnection.BlockingMultiResultSetConsumer, JdbcConnection.BlockingResultSetConsumer, JdbcConnection.CallPreparer, JdbcConnection.ConnectionFactory, JdbcConnection.MultiResultSetConsumer, JdbcConnection.Operations, JdbcConnection.ParameterResultSetConsumer, JdbcConnection.ResultSetConsumer, JdbcConnection.ResultSetExtractor<T extends Object>, JdbcConnection.ResultSetMapper<T extends Object>, JdbcConnection.StatementFactory, JdbcConnection.StatementPreparer
-
-
Field Summary
Fields Modifier and Type Field Description private OracleDatabaseVersiondatabaseVersionThe database version.private static org.slf4j.LoggerLOGGERprivate static intORACLE_UNSET_SCALEReturned by column metadata in Oracle if no scale is set;private static PatternSYS_NC_PATTERNPattern to identify system generated indices and column names.private static FieldURLA field for the raw jdbc url.
-
Constructor Summary
Constructors Constructor Description OracleConnection(Configuration config, Supplier<ClassLoader> classLoaderSupplier)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringconnectionString(Configuration config)OracleConnectionexecuteLegacy(JdbcConnection.Operations operations)OracleConnectionexecuteLegacy(String... sqlStatements)protected Set<TableId>getAllTableIds(String catalogName)Retrieves allTableIdin a given database catalog, filtering certain ids that should be omitted from the returned set such as special spatial tables and index-organized tables.OracleDatabaseVersiongetOracleVersion()private ResultSetgetTableColumnsInfo(String schemaNamePattern, String tableName)booleangetTablenameCaseInsensitivity(OracleConnectorConfig connectorConfig)Resolve the table name case insensitivity used by the schema based on the following rules: If option is provided in connector configuration, it will be used. Otherwise resolved by database version where Oracle 11 will betrue; otherwisefalse.protected booleanisTableUniqueIndexIncluded(String indexName, String columnName)private voidoverrideOracleSpecificColumnTypes(Tables tables, TableId tableId, TableId tableIdWithCatalog)voidreadSchema(Tables tables, String databaseCatalog, String schemaNamePattern, Tables.TableFilter tableFilter, Tables.ColumnNameFilter columnFilter, boolean removeTablesNotFoundInJdbc)voidreadSchemaForCapturedTables(Tables tables, String databaseCatalog, String schemaNamePattern, Tables.ColumnNameFilter columnFilter, boolean removeTablesNotFoundInJdbc, Set<TableId> capturedTables)Set<TableId>readTableNames(String databaseCatalog, String schemaNamePattern, String tableNamePattern, String[] tableTypes)List<String>readTableUniqueIndices(DatabaseMetaData metadata, TableId id)voidresetSessionToCdb()private static JdbcConnection.ConnectionFactoryresolveConnectionFactory(Configuration config)private OracleDatabaseVersionresolveOracleDatabaseVersion()voidsetSessionToPdb(String pdbName)-
Methods inherited from class io.debezium.jdbc.JdbcConnection
call, close, commit, config, connect, connection, connection, connectionString, database, execute, execute, executeWithoutCommitting, getDefaultValue, isConnected, isNullable, parseSqlStatementString, patternBasedFactory, patternBasedFactory, prepareQuery, prepareQuery, prepareQuery, prepareQuery, prepareQueryAndMap, prepareQueryWithBlockingConsumer, prepareUpdate, print, print, query, query, queryAndMap, queryAndMap, querySingleValue, queryWithBlockingConsumer, readAllCatalogNames, readAllSchemaNames, readAllTableNames, readPrimaryKeyNames, readPrimaryKeyOrUniqueIndexNames, readTableColumn, resolveJdbcType, resolveNativeType, rollback, setAutoCommit, singleResultMapper, tableTypes, username
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
ORACLE_UNSET_SCALE
private static final int ORACLE_UNSET_SCALE
Returned by column metadata in Oracle if no scale is set;- See Also:
- Constant Field Values
-
SYS_NC_PATTERN
private static final Pattern SYS_NC_PATTERN
Pattern to identify system generated indices and column names.
-
URL
private static final Field URL
A field for the raw jdbc url. This field has no default value.
-
databaseVersion
private final OracleDatabaseVersion databaseVersion
The database version.
-
-
Constructor Detail
-
OracleConnection
public OracleConnection(Configuration config, Supplier<ClassLoader> classLoaderSupplier)
-
-
Method Detail
-
setSessionToPdb
public void setSessionToPdb(String pdbName)
-
resetSessionToCdb
public void resetSessionToCdb()
-
getOracleVersion
public OracleDatabaseVersion getOracleVersion()
-
resolveOracleDatabaseVersion
private OracleDatabaseVersion resolveOracleDatabaseVersion()
-
readTableNames
public Set<TableId> readTableNames(String databaseCatalog, String schemaNamePattern, String tableNamePattern, String[] tableTypes) throws SQLException
- Overrides:
readTableNamesin classJdbcConnection- Throws:
SQLException
-
getAllTableIds
protected Set<TableId> getAllTableIds(String catalogName) throws SQLException
Retrieves allTableIdin a given database catalog, filtering certain ids that should be omitted from the returned set such as special spatial tables and index-organized tables.- Parameters:
catalogName- the catalog/database name- Returns:
- set of all table ids for existing table objects
- Throws:
SQLException- if a database exception occurred
-
getTableColumnsInfo
private ResultSet getTableColumnsInfo(String schemaNamePattern, String tableName) throws SQLException
- Throws:
SQLException
-
readSchemaForCapturedTables
public void readSchemaForCapturedTables(Tables tables, String databaseCatalog, String schemaNamePattern, Tables.ColumnNameFilter columnFilter, boolean removeTablesNotFoundInJdbc, Set<TableId> capturedTables) throws SQLException
- Throws:
SQLException
-
readSchema
public void readSchema(Tables tables, String databaseCatalog, String schemaNamePattern, Tables.TableFilter tableFilter, Tables.ColumnNameFilter columnFilter, boolean removeTablesNotFoundInJdbc) throws SQLException
- Overrides:
readSchemain classJdbcConnection- Throws:
SQLException
-
readTableUniqueIndices
public List<String> readTableUniqueIndices(DatabaseMetaData metadata, TableId id) throws SQLException
- Overrides:
readTableUniqueIndicesin classJdbcConnection- Throws:
SQLException
-
isTableUniqueIndexIncluded
protected boolean isTableUniqueIndexIncluded(String indexName, String columnName)
- Overrides:
isTableUniqueIndexIncludedin classJdbcConnection
-
overrideOracleSpecificColumnTypes
private void overrideOracleSpecificColumnTypes(Tables tables, TableId tableId, TableId tableIdWithCatalog)
-
getTablenameCaseInsensitivity
public boolean getTablenameCaseInsensitivity(OracleConnectorConfig connectorConfig)
Resolve the table name case insensitivity used by the schema based on the following rules:- If option is provided in connector configuration, it will be used.
- Otherwise resolved by database version where Oracle 11 will be
true; otherwisefalse.
- Parameters:
connectorConfig- the connector configuration- Returns:
- whether table name case insensitivity is used
-
executeLegacy
public OracleConnection executeLegacy(String... sqlStatements) throws SQLException
- Throws:
SQLException
-
executeLegacy
public OracleConnection executeLegacy(JdbcConnection.Operations operations) throws SQLException
- Throws:
SQLException
-
connectionString
public static String connectionString(Configuration config)
-
resolveConnectionFactory
private static JdbcConnection.ConnectionFactory resolveConnectionFactory(Configuration config)
-
-