Package liquibase.database
Class DatabaseFactory
java.lang.Object
liquibase.database.DatabaseFactory
- All Implemented Interfaces:
SingletonObject
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Removes all registered databases, even built in ones.findCorrectDatabaseImplementation
(DatabaseConnection connection) findDefaultDriver
(String url) Returns the Java class name of the JDBC driver class (e.g.getDatabase
(String shortName) Returns instances of all implemented database types.static DatabaseFactory
Returns instances of all "internal" database types.openConnection
(String url, String username, String password, String driver, String databaseClass, String driverPropertiesFile, String propertyProviderClass, ResourceAccessor resourceAccessor) openConnection
(String url, String username, String driver, String databaseClass, Properties driverProperties, ResourceAccessor resourceAccessor) openConnection
(String url, String username, String password, String propertyProvider, ResourceAccessor resourceAccessor) openDatabase
(String url, String username, String password, String driver, String databaseClass, String driverPropertiesFile, String propertyProviderClass, ResourceAccessor resourceAccessor) openDatabase
(String url, String username, String driver, String databaseClass, Properties driverProperties, ResourceAccessor resourceAccessor) openDatabase
(String url, String username, String password, String propertyProviderClass, ResourceAccessor resourceAccessor) void
static void
reset()
static void
setInstance
(DatabaseFactory databaseFactory) Set singleton instance.
-
Method Details
-
getInstance
-
setInstance
Set singleton instance. Primarily used in testing -
reset
public static void reset() -
getImplementedDatabases
Returns instances of all implemented database types. -
getInternalDatabases
Returns instances of all "internal" database types. -
register
-
findCorrectDatabaseImplementation
public Database findCorrectDatabaseImplementation(DatabaseConnection connection) throws DatabaseException - Throws:
DatabaseException
-
openDatabase
public Database openDatabase(String url, String username, String password, String propertyProviderClass, ResourceAccessor resourceAccessor) throws DatabaseException - Throws:
DatabaseException
-
openDatabase
public Database openDatabase(String url, String username, String password, String driver, String databaseClass, String driverPropertiesFile, String propertyProviderClass, ResourceAccessor resourceAccessor) throws DatabaseException - Throws:
DatabaseException
-
openDatabase
public Database openDatabase(String url, String username, String driver, String databaseClass, Properties driverProperties, ResourceAccessor resourceAccessor) throws DatabaseException - Throws:
DatabaseException
-
openConnection
public DatabaseConnection openConnection(String url, String username, String password, String propertyProvider, ResourceAccessor resourceAccessor) throws DatabaseException - Throws:
DatabaseException
-
openConnection
public DatabaseConnection openConnection(String url, String username, String password, String driver, String databaseClass, String driverPropertiesFile, String propertyProviderClass, ResourceAccessor resourceAccessor) throws DatabaseException - Throws:
DatabaseException
-
openConnection
public DatabaseConnection openConnection(String url, String username, String driver, String databaseClass, Properties driverProperties, ResourceAccessor resourceAccessor) throws DatabaseException - Throws:
DatabaseException
-
findDefaultDriver
Returns the Java class name of the JDBC driver class (e.g. "org.mariadb.jdbc.Driver") for the specified JDBC URL, if any Database class supports that URL.- Parameters:
url
- the JDBC URL to analyse- Returns:
- a Database object supporting the URL. May also return null if the JDBC URL is unknown to all handlers.
-
clearRegistry
public void clearRegistry()Removes all registered databases, even built in ones. Useful for forcing a particular database implementation -
getDatabase
-