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)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.ScngetCurrentScn()Get the current, most recent system change number.OracleDatabaseVersiongetOracleVersion()private ResultSetgetTableColumnsInfo(String schemaNamePattern, String tableName)StringgetTableMetadataDdl(TableId tableId)Generate a given table's DDL metadata.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
buildSelectWithRowLimits, call, close, commit, config, connect, connection, connection, connectionString, database, execute, execute, executeWithoutCommitting, getColumnValue, getDefaultValue, isConnected, isNullable, parseSqlStatementString, patternBasedFactory, patternBasedFactory, prepareQuery, prepareQuery, prepareQuery, prepareQuery, prepareQueryAndMap, prepareQueryWithBlockingConsumer, prepareUpdate, print, print, query, query, queryAndMap, queryAndMap, querySingleValue, queryWithBlockingConsumer, quotedTableIdString, readAllCatalogNames, readAllSchemaNames, readAllTableNames, readPrimaryKeyNames, readPrimaryKeyOrUniqueIndexNames, readTableColumn, readTablePreparedStatement, readTableStatement, resolveJdbcType, resolveNativeType, rollback, rowToArray, 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)
-
getCurrentScn
public Scn getCurrentScn() throws SQLException
Get the current, most recent system change number.- Returns:
- the current system change number
- Throws:
SQLException- if an exception occurredIllegalStateException- if the query does not return at least one row
-
getTableMetadataDdl
public String getTableMetadataDdl(TableId tableId) throws SQLException
Generate a given table's DDL metadata.- Parameters:
tableId- table identifier, should never benull- Returns:
- generated DDL
- Throws:
SQLException- if an exception occurred obtaining the DDL metadata
-
connectionString
public static String connectionString(Configuration config)
-
resolveConnectionFactory
private static JdbcConnection.ConnectionFactory resolveConnectionFactory(Configuration config)
-
-