Specifying Properties in a Connection Profile
Note: The Connection Profile is optional. This data is not required for liquibase.properties
to function successfully.
A connection profile contains the information that Liquibase needs to connect to a particular database. It resides in the text-based Liquibase properties file, liquibase.properties
, along with other properties that rarely change. A connection profile eliminates the need to enter properties through the command prompt as parameters, saving you time and potential typographical errors.
Parameters that are entered at a command prompt override values that are specified in a connection profile.
Creating a connection profile
To create a connection profile, generate a new text file in your project Liquibase directory and name it liquibase.properties
.
Note: The file can be named something other than liquibase.properties
and reside in a different directory by using the --defaultsFile
attribute every time you run a Liquibase command.
For more information, see Working with Command Parameters.
Example Properties File
The following example properties file describes a connection profile for an Oracle database.
changelog-file: ../path/to/file/dbchangelog.xml
driver: oracle.jdbc.OracleDriver
url: jdbc:oracle:thin:@192.168.0.22:1521/orcl
username: PRO
password: password
referenceDriver: oracle.jdbc.OracleDriver
referenceUrl: jdbc:oracle:thin:@192.168.0.22:1521/orcl
referencePassword: password
liquibaseProLicenseKey: aeioufakekey32aeioufakekey785463214
classpath: ../path/to/file/ojdbc6-11.2.0.3.0.jar
Activating a Liquibase Pro License Key
To activate a Liquibase Pro license key, perform the following steps:
- Using a text editor, open the Liquibase properties file.
- Add
liquibaseProLicenseKey:
to the list of parameters. - Specify your license key as the value, as the previous example shows.
- Save the properties file.
Properties
The values in a properties file must be specific to the database that it describes. Liquibase recommends configuring the properties file to include your driver, class path, and URL. For more information about property formats, see Liquibase Database Tutorials and select the appropriate database.
Note: Although Liquibase allows for the storage of user-authentication information (username and password) in the properties file, we recommend that you store user credentials in a secure credential repository or enter them in the CLI when running a command.
The following table identifies additional properties that can be specified in the Liquibase properties file.
Note: Some of these properties are optional. If it has the Optional tag underneath the definition, this data is not required for liquibase.properties to function successfully.
Property | Definition |
---|---|
changelog-file
|
Specifies the path to the changelog to execute. |
driver
|
Specifies the driver class name for the target database. |
referenceUrl
|
Specifies the source database for performing comparisons. Optional |
username
|
Specifies the username for the target database. |
password
|
Specifies the password for the target database. |
referenceDriver
|
Specifies the driver class name for the source database. Optional |
url
|
Specifies the database to use when making comparisons to the source database. Also known as the target. |
referenceUsername
|
Specifies the username for the source database. Optional |
referencePassword
|
Specifies the password for the source database. |
liquibaseProLicenseKey
|
Specifies the Liquibase Pro license key, if applicable. When added to the Liquibase properties file, liquibaseProLicenseKey eliminates the need to type the license key every time you enter a Liquibase command. |
classpath
|
Specifies the directories and jar files to search for changelog files and custom extension classes.
To separate multiple directories, use a semicolon (; ) on Windows or a colon (: ) on Linux or MacOS. |
|
Specifies the custom ChangeExecListener implementation to use. |
|
Specifies properties for ChangeExecListener. |
|
Specifies the author of automatically generated changesets. |
|
Specifies the execution context to use for changesets in the generated changelog. Use a comma ( |
|
Specifies changeset Contexts to run. |
|
Overrides the current |
|
Specifies the Liquibase changelog lock table. Default value is |
|
Specifies the Liquibase changelog table. Default value is |
|
Specifies the tablespace in which the |
|
Specifies the custom database implementation. |
|
Specifies the directory in which insert statement CSV files are maintained. Required by the generate-changelog command. |
|
Specifies the default catalog name for the database connection. |
|
Specifies the default schema name for the database connection. |
|
Sets the string that breaks up files that consist of multiple statements. Used with |
|
Specifies the Note:Available options depend on the Liquibase product, version, and plugins. |
|
Specifies the location of the JDBC connection file whose properties the driver uses. |
|
Specifies objects to exclude from the changelog. Example filters: |
|
Includes the catalog in the generated changesets. Default value is |
|
Specifies objects to include in the changelog. Example filters: |
|
Includes the schema in the generated changesets. Default value is |
|
Include the system classpath in the Liquibase classpath. Default value is |
|
Includes the tablespace of tables and indexes. Default value is |
|
Filters the changelog using Labels. |
|
Specifies the catalog name in which the Liquibase tables are located. The concept of a catalog varies between databases because not all databases feature catalogs. For more information, refer to your database documentation. |
|
Specifies API key for authorization to Liquibase Hub. |
liquibaseHubConnectionid
|
Identifies the target in which to record your data at Liquibase Hub. The property is available from within a project at https://hub.liquibase.com. Liquibase 4.4 and later support the following format: |
liquibaseHubProjectId
|
Identifies the project in which to record your data at Liquibase Hub. The property is available from within your account at https://hub.liquibase.com. Liquibase 4.4 and later support the following format: |
|
Specifies URL to Hub. |
|
Specifies the schema name in which the Liquibase tables are located. |
|
Sends logging messages to a file. |
|
Specifies the execution log level as |
|
Specifies the catalog name that the SQL object references include, even if it is the default catalog. |
|
Specifies the schema name that the SQL object references include, even if it is the default schema. |
|
Specifies the target file for command-written output. |
|
Uses the names as |
|
Forces overwriting the generated changelog/SQL files. |
|
Passes properties that begin with a parameter as changelog parameters. For example, setting |
|
Prompts if non-localhost databases are detected. Default value is |
|
Specifies the custom properties implementation. |
|
Specifies the reference database catalog. |
|
Specifies the reference database schema. |
|
Specifies a comma-separated list of reference database schemas from which to include objects when running a command, such as |
|
Specifies the path to a rollback script that overrides the changelog rollback logic. |
|
Specifies a comma-separated list of database schemas |
|
Specifies the file format when you run the snapshot command and snapshot-reference command. |
|
Specifies the file in which SQL statements are stored. |
|
Specifies whether Liquibase fails with a validation error when the properties file, |
Additional Liquibase Properties
The following table identifies additional properties that the Liquibase properties file supports in Liquibase 4.1 and later. To use them with an earlier version, set them as as java system properties, as the following CLI examples show:
- Windows:
set JAVA_OPTS=-Dliquibase.x=a -Dliquibase.y=b && liquibase --changelog-file=dbchangelog.sql update
- Linux:
JAVA_OPTS="-Dliquibase.x=a -Dliquibase.y=b" liquibase --changelog-file=dbchangelog.sql update
Property | Definition |
---|---|
|
Does not output the warning if the value is set to |
|
Defines whether Liquibase will run. If the value is set to |
|
Specifies the line separator for the output. Default value is set to OS default one. |
|
Specifies a number of minutes to wait for the changelog lock to be available. Default value is: 5. |
|
Specifies a number of seconds to wait between checks to the changelog lock when it is locked. Default value is: 10. |
|
Defines whether Liquibase converts to/from |
|
Specifies the encoding to output text in. Default value is set to |
|
Defines whether Liquibase includes a 'created' attribute in |
|
Defines whether Liquibase automatically includes |
|
Defines whether Liquibase compares column order in the |
|
Defines whether the procedure schema is forced to the default schema if no |
|
Defines whether Liquibase includes the change description in the |
|
Defines whether Liquibase makes snapshots of data by default. Default value is: |
|
Defines whether Liquibase filters log messages for potentially insecure data. Default value is: |
|
Controls the level of data sent to Liquibase Hub. The values are |
|
Calls |
|
Does not drop public synonyms in |
|
Generates changesets with SQL-based changes embedded instead of saving them to an external file if the value is set to |