public class SqlServerConnection extends JdbcConnection
JdbcConnection extension to be used with Microsoft SQL Server| Modifier and Type | Class and Description |
|---|---|
static class |
SqlServerConnection.CdcEnabledTable |
private static interface |
SqlServerConnection.ResultSetExtractor<T> |
JdbcConnection.BlockingMultiResultSetConsumer, JdbcConnection.BlockingResultSetConsumer, JdbcConnection.CallPreparer, JdbcConnection.ConnectionFactory, JdbcConnection.MultiResultSetConsumer, JdbcConnection.Operations, JdbcConnection.ParameterResultSetConsumer, JdbcConnection.ResultSetConsumer, JdbcConnection.ResultSetMapper<T>, JdbcConnection.StatementFactory, JdbcConnection.StatementPreparer| Modifier and Type | Field and Description |
|---|---|
private static int |
CHANGE_TABLE_DATA_COLUMN_OFFSET |
private static JdbcConnection.ConnectionFactory |
FACTORY |
private static String |
GET_ALL_CHANGES_FOR_TABLE |
private static String |
GET_DATABASE_NAME |
private static String |
GET_LIST_OF_CDC_ENABLED_TABLES |
private static String |
GET_LIST_OF_KEY_COLUMNS |
private static String |
GET_LIST_OF_NEW_CDC_ENABLED_TABLES |
private static String |
GET_MAX_LSN |
private static String |
INCREMENT_LSN |
private static String |
LOCK_TABLE |
private static org.slf4j.Logger |
LOGGER |
private static String |
LSN_TO_TIMESTAMP |
private BoundedConcurrentHashMap<Lsn,Instant> |
lsnToInstantCache |
private String |
realDatabaseName
actual name of the database, which could differ in casing from the database name given in the connector config.
|
private static String |
STATEMENTS_PLACEHOLDER |
private static String |
URL_PATTERN |
| Constructor and Description |
|---|
SqlServerConnection(Configuration config)
Creates a new connection using the supplied configuration.
|
| Modifier and Type | Method and Description |
|---|---|
private String |
cdcNameForTable(TableId tableId) |
void |
getChangesForTable(TableId tableId,
Lsn fromLsn,
Lsn toLsn,
JdbcConnection.ResultSetConsumer consumer)
Provides all changes recorded by the SQL Server CDC capture process for a given table.
|
void |
getChangesForTables(ChangeTable[] changeTables,
Lsn intervalFromLsn,
Lsn intervalToLsn,
JdbcConnection.BlockingMultiResultSetConsumer consumer)
Provides all changes recorder by the SQL Server CDC capture process for a set of tables.
|
Lsn |
getMaxLsn() |
String |
getNameOfChangeTable(String captureName) |
String |
getRealDatabaseName() |
Table |
getTableSchemaFromChangeTable(ChangeTable changeTable) |
Table |
getTableSchemaFromTable(ChangeTable changeTable) |
Lsn |
incrementLsn(Lsn lsn)
Obtain the next available position in the database log.
|
Set<ChangeTable> |
listOfChangeTables() |
Set<ChangeTable> |
listOfNewChangeTables(Lsn fromLsn,
Lsn toLsn) |
void |
lockTable(TableId tableId)
Creates an exclusive lock for a given table.
|
private String |
retrieveRealDatabaseName() |
void |
rollback() |
private <T> JdbcConnection.ResultSetMapper<T> |
singleResultMapper(SqlServerConnection.ResultSetExtractor<T> extractor,
String error) |
Instant |
timestampOfLsn(Lsn lsn)
Map a commit LSN to a point in time when the commit happened.
|
call, close, columnsFor, columnsFor, config, connect, connection, connection, connectionString, database, execute, execute, executeWithoutCommitting, isConnected, parseSqlStatementString, patternBasedFactory, patternBasedFactory, prepareQuery, prepareQuery, prepareQuery, prepareQuery, prepareQueryAndMap, prepareQueryWithBlockingConsumer, prepareUpdate, print, print, query, query, queryAndMap, queryAndMap, queryWithBlockingConsumer, readAllCatalogNames, readAllSchemaNames, readAllTableNames, readPrimaryKeyNames, readSchema, readTableColumn, readTableNames, resolveNativeType, setAutoCommit, tableTypes, usernameprivate static final String GET_DATABASE_NAME
private static org.slf4j.Logger LOGGER
private static final String STATEMENTS_PLACEHOLDER
private static final String GET_MAX_LSN
private static final String LOCK_TABLE
private static final String LSN_TO_TIMESTAMP
private static final String INCREMENT_LSN
private static final String GET_ALL_CHANGES_FOR_TABLE
private static final String GET_LIST_OF_CDC_ENABLED_TABLES
private static final String GET_LIST_OF_NEW_CDC_ENABLED_TABLES
private static final String GET_LIST_OF_KEY_COLUMNS
private static final int CHANGE_TABLE_DATA_COLUMN_OFFSET
private static final String URL_PATTERN
private static final JdbcConnection.ConnectionFactory FACTORY
private final String realDatabaseName
private final BoundedConcurrentHashMap<Lsn,Instant> lsnToInstantCache
public SqlServerConnection(Configuration config)
config - Configuration instance, may not be null.public Lsn getMaxLsn() throws SQLException
SQLExceptionpublic void getChangesForTable(TableId tableId, Lsn fromLsn, Lsn toLsn, JdbcConnection.ResultSetConsumer consumer) throws SQLException
tableId - - the requested table changesfromLsn - - closed lower bound of interval of changes to be providedtoLsn - - closed upper bound of interval of changes to be providedconsumer - - the change processorSQLExceptionpublic void getChangesForTables(ChangeTable[] changeTables, Lsn intervalFromLsn, Lsn intervalToLsn, JdbcConnection.BlockingMultiResultSetConsumer consumer) throws SQLException, InterruptedException
changeTables - - the requested tables to obtain changes forintervalFromLsn - - closed lower bound of interval of changes to be providedintervalToLsn - - closed upper bound of interval of changes to be providedconsumer - - the change processorSQLExceptionInterruptedExceptionpublic Lsn incrementLsn(Lsn lsn) throws SQLException
lsn - - LSN of the current positionSQLExceptionpublic Instant timestampOfLsn(Lsn lsn) throws SQLException
lsn - - LSN of the commitSQLExceptionpublic void lockTable(TableId tableId) throws SQLException
tableId - to be lockedSQLExceptionprivate <T> JdbcConnection.ResultSetMapper<T> singleResultMapper(SqlServerConnection.ResultSetExtractor<T> extractor, String error) throws SQLException
SQLExceptionpublic Set<ChangeTable> listOfChangeTables() throws SQLException
SQLExceptionpublic Set<ChangeTable> listOfNewChangeTables(Lsn fromLsn, Lsn toLsn) throws SQLException
SQLExceptionpublic Table getTableSchemaFromTable(ChangeTable changeTable) throws SQLException
SQLExceptionpublic Table getTableSchemaFromChangeTable(ChangeTable changeTable) throws SQLException
SQLExceptionpublic void rollback()
throws SQLException
SQLExceptionpublic String getRealDatabaseName()
private String retrieveRealDatabaseName()
Copyright © 2019 JBoss by Red Hat. All rights reserved.