Package liquibase.database.jvm
Class JdbcConnection
- java.lang.Object
-
- liquibase.database.jvm.JdbcConnection
-
- All Implemented Interfaces:
AutoCloseable,DatabaseConnection,PrioritizedService
- Direct Known Subclasses:
DerbyConnection,HsqlConnection,SybaseASAConnection,SybaseConnection
public class JdbcConnection extends Object implements DatabaseConnection
A ConnectionWrapper implementation which delegates completely to an underlying java.sql.connection.
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILTER_CREDSstatic StringFILTER_CREDS_MYSQL_TO_OBFUSCATEstatic StringFILTER_CREDS_ORACLE_TO_OBFUSCATEstatic StringFILTER_CREDS_PASSWORDstatic StringFILTER_CREDS_PRIVATE_KEY_FILEstatic StringFILTER_CREDS_PRIVATE_KEY_FILE_PWDstatic StringFILTER_CREDS_PRIVATE_KEY_TO_BLANKstatic StringFILTER_CREDS_USER-
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description JdbcConnection()JdbcConnection(Connection connection)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface liquibase.database.DatabaseConnection
supports
-
-
-
-
Field Detail
-
FILTER_CREDS_PRIVATE_KEY_TO_BLANK
public static final String FILTER_CREDS_PRIVATE_KEY_TO_BLANK
- See Also:
- Constant Field Values
-
FILTER_CREDS_PASSWORD
public static final String FILTER_CREDS_PASSWORD
- See Also:
- Constant Field Values
-
FILTER_CREDS_USER
public static final String FILTER_CREDS_USER
- See Also:
- Constant Field Values
-
FILTER_CREDS_PRIVATE_KEY_FILE
public static final String FILTER_CREDS_PRIVATE_KEY_FILE
- See Also:
- Constant Field Values
-
FILTER_CREDS_PRIVATE_KEY_FILE_PWD
public static final String FILTER_CREDS_PRIVATE_KEY_FILE_PWD
- See Also:
- Constant Field Values
-
FILTER_CREDS
public static final String FILTER_CREDS
- See Also:
- Constant Field Values
-
FILTER_CREDS_MYSQL_TO_OBFUSCATE
public static final String FILTER_CREDS_MYSQL_TO_OBFUSCATE
- See Also:
- Constant Field Values
-
FILTER_CREDS_ORACLE_TO_OBFUSCATE
public static final String FILTER_CREDS_ORACLE_TO_OBFUSCATE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JdbcConnection
public JdbcConnection()
-
JdbcConnection
public JdbcConnection(Connection connection)
-
-
Method Detail
-
getPriority
public int getPriority()
- Specified by:
getPriorityin interfacePrioritizedService
-
open
public void open(String url, Driver driverObject, Properties driverProperties) throws DatabaseException
- Specified by:
openin interfaceDatabaseConnection- Throws:
DatabaseException
-
attached
public void attached(Database database)
- Specified by:
attachedin interfaceDatabaseConnection
-
getDatabaseProductName
public String getDatabaseProductName() throws DatabaseException
- Specified by:
getDatabaseProductNamein interfaceDatabaseConnection- Throws:
DatabaseException
-
getDatabaseProductVersion
public String getDatabaseProductVersion() throws DatabaseException
- Specified by:
getDatabaseProductVersionin interfaceDatabaseConnection- Throws:
DatabaseException
-
getDatabaseMajorVersion
public int getDatabaseMajorVersion() throws DatabaseException- Specified by:
getDatabaseMajorVersionin interfaceDatabaseConnection- Throws:
DatabaseException
-
getDatabaseMinorVersion
public int getDatabaseMinorVersion() throws DatabaseException- Specified by:
getDatabaseMinorVersionin interfaceDatabaseConnection- Throws:
DatabaseException
-
getURL
public String getURL()
- Specified by:
getURLin interfaceDatabaseConnection
-
sanitizeUrl
public static String sanitizeUrl(String url)
Remove any secure information from the URL. Used for logging purposes Strips off the;password=property from string. Note: it does not remove the password from theuser:password@hostsection- Parameters:
url- string to remove password=xxx from- Returns:
- modified string
-
getConnectionUrl
protected String getConnectionUrl() throws SQLException
- Throws:
SQLException
-
getConnectionUserName
public String getConnectionUserName()
- Specified by:
getConnectionUserNamein interfaceDatabaseConnection
-
getWrappedConnection
public Connection getWrappedConnection()
Returns the connection that this Delegate is using.- Returns:
- The connection originally passed in the constructor
-
clearWarnings
public void clearWarnings() throws DatabaseException- Throws:
DatabaseException
-
close
public void close() throws DatabaseException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDatabaseConnection- Throws:
DatabaseException
-
commit
public void commit() throws DatabaseException- Specified by:
commitin interfaceDatabaseConnection- Throws:
DatabaseException
-
createStatement
public Statement createStatement() throws DatabaseException
- Throws:
DatabaseException
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws DatabaseException
- Throws:
DatabaseException
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws DatabaseException
- Throws:
DatabaseException
-
getAutoCommit
public boolean getAutoCommit() throws DatabaseException- Specified by:
getAutoCommitin interfaceDatabaseConnection- Throws:
DatabaseException
-
getCatalog
public String getCatalog() throws DatabaseException
- Specified by:
getCatalogin interfaceDatabaseConnection- Throws:
DatabaseException
-
getHoldability
public int getHoldability() throws DatabaseException- Throws:
DatabaseException
-
getMetaData
public DatabaseMetaData getMetaData() throws DatabaseException
- Throws:
DatabaseException
-
getTransactionIsolation
public int getTransactionIsolation() throws DatabaseException- Throws:
DatabaseException
-
getTypeMap
public Map<String,Class<?>> getTypeMap() throws DatabaseException
- Throws:
DatabaseException
-
getWarnings
public SQLWarning getWarnings() throws DatabaseException
- Throws:
DatabaseException
-
isClosed
public boolean isClosed() throws DatabaseException- Specified by:
isClosedin interfaceDatabaseConnection- Throws:
DatabaseException
-
isReadOnly
public boolean isReadOnly() throws DatabaseException- Throws:
DatabaseException
-
nativeSQL
public String nativeSQL(String sql) throws DatabaseException
- Specified by:
nativeSQLin interfaceDatabaseConnection- Throws:
DatabaseException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws DatabaseException
- Throws:
DatabaseException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws DatabaseException
- Throws:
DatabaseException
-
prepareCall
public CallableStatement prepareCall(String sql) throws DatabaseException
- Throws:
DatabaseException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws DatabaseException
- Throws:
DatabaseException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws DatabaseException
- Throws:
DatabaseException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws DatabaseException
- Throws:
DatabaseException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws DatabaseException
- Throws:
DatabaseException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws DatabaseException
- Throws:
DatabaseException
-
prepareStatement
public PreparedStatement prepareStatement(String sql) throws DatabaseException
- Throws:
DatabaseException
-
releaseSavepoint
public void releaseSavepoint(Savepoint savepoint) throws DatabaseException
- Throws:
DatabaseException
-
rollback
public void rollback() throws DatabaseException- Specified by:
rollbackin interfaceDatabaseConnection- Throws:
DatabaseException
-
rollback
public void rollback(Savepoint savepoint) throws DatabaseException
- Throws:
DatabaseException
-
setAutoCommit
public void setAutoCommit(boolean autoCommit) throws DatabaseException- Specified by:
setAutoCommitin interfaceDatabaseConnection- Throws:
DatabaseException
-
setCatalog
public void setCatalog(String catalog) throws DatabaseException
- Throws:
DatabaseException
-
setHoldability
public void setHoldability(int holdability) throws DatabaseException- Throws:
DatabaseException
-
setReadOnly
public void setReadOnly(boolean readOnly) throws DatabaseException- Throws:
DatabaseException
-
setSavepoint
public Savepoint setSavepoint() throws DatabaseException
- Throws:
DatabaseException
-
setSavepoint
public Savepoint setSavepoint(String name) throws DatabaseException
- Throws:
DatabaseException
-
setTransactionIsolation
public void setTransactionIsolation(int level) throws DatabaseException- Throws:
DatabaseException
-
setTypeMap
public void setTypeMap(Map<String,Class<?>> map) throws DatabaseException
- Throws:
DatabaseException
-
getUnderlyingConnection
public Connection getUnderlyingConnection()
-
supportsBatchUpdates
public boolean supportsBatchUpdates() throws DatabaseException- Throws:
DatabaseException
-
-