Package org.pjdbc.drivers
Class TeeDriver
java.lang.Object
org.pjdbc.sql.AbstractDriver
org.pjdbc.sql.AbstractProxyDriver
org.pjdbc.drivers.TeeDriver
- All Implemented Interfaces:
Driver
@DriverCapability(prefix="tee",
description="Replicates operations across multiple database connections",
capabilities="replication")
@DriverSideEffects(stateful=true)
public class TeeDriver
extends AbstractProxyDriver
Replicates write operations across multiple database connections.
TeeDriver sends all operations to two database connections simultaneously, useful for scenarios like:
- Write replication to a secondary database
- Dual-write during migration periods
- Keeping audit databases in sync
Warning: TeeDriver does not provide transactional guarantees across the two connections. If one write succeeds and the other fails, the databases will be inconsistent.
URL format: jdbc:tee:jdbc:target1:...;jdbc:target2:...
Example:
jdbc:tee:jdbc:postgresql://primary/db;jdbc:postgresql://replica/db
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanacceptsSubName(String subname) protected booleanacceptsSubProtocol(String subprotocol) connect(String url, Properties info) Methods inherited from class org.pjdbc.sql.AbstractProxyDriver
getPropertyInfo, isCompositionValidationEnabled, isValidateParametersEnabled, proxyCallableStatement, proxyCallableStatement, proxyConnection, proxyConnection, proxyConnection, proxyPreparedStatement, proxyPreparedStatement, proxyResultSet, proxyStatementMethods inherited from class org.pjdbc.sql.AbstractDriver
acceptsProtocol, acceptsURL, getMajorVersion, getMinorVersion, getParentLogger, getUrlParameter, getUrlParameter, getUrlParameters, jdbcCompliant, parseUrl, protocol, subname, subprotocol, validateParameters
-
Constructor Details
-
TeeDriver
public TeeDriver()
-
-
Method Details
-
acceptsSubName
- Overrides:
acceptsSubNamein classAbstractProxyDriver
-
acceptsSubProtocol
- Specified by:
acceptsSubProtocolin classAbstractDriver
-
connect
- Specified by:
connectin interfaceDriver- Overrides:
connectin classAbstractProxyDriver- Throws:
SQLException
-