Using JDBC URL in Liquibase
source link: https://docs.liquibase.com/workflows/liquibase-community/using-jdbc-url-in-liquibase.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Using JDBC URL in Liquibase
A JDBC URL is a database connection URL that identifies a database so that the appropriate driver recognizes it and connects to it. Liquibase requires a JDBC driver to establish a connection between Liquibase and your database.
All JDBC URLs begin with jdbc:
. The format of other string elements depends on the JDBC driver. In most cases, the format of the database connection URL resembles the following example:
jdbc:<database>://<host>:<port>/<database_name>;<URL_attributes>
database name | Name of the database to which you want to connect. Can also be the file system path to the database. |
URL attributes | Supported attributes of the database connection URL, such as upgrade=true and create=true . |
host | Name or address of the machine on which the server is running. |
port | Port number that the server framework uses. |
To use the JDBC URL, complete one of the following tasks:
-
Run the
--url
parameter in the CLI:
--url=jdbc:<database>://<host>:<port>/<database_name>;<URL_attributes>
-
Configure
LIQUIBASE_COMMAND_URL
as an environment variable to set it once and pass connection information to Liquibase and your database. Environment variables are only available in Liquibase Pro.
LIQUIBASE_COMMAND_URL =jdbc:<database>://<host>:<port>/<database_name>;<URL_attributes>
-
In the Liquibase properties file, specify a value for
liquibase.command.url
to set it once and pass connection information to Liquibase and your database.
url: jdbc:<database>://<host>:<port>/<database_name>;<URL_attributes>
Note: Command-line arguments override environment variables and the Liquibase properties file data. Environment variables override the properties file data. The properties file does not override any values.
JDBC URL examples
Database | URL |
---|---|
Apache Derby | jdbc:derby://localhost:1527/yourdatabase;create=true
|
AWS Redshift |
AWS example: |
Cassandra | jdbc:cassandra://localhost:9042/yourKeyspace;DefaultKeyspace=yourKeyspace
|
Cassandra on DataStax Astra |
For more information, see Using Liquibase with Cassandra on DataStax Astra. |
Cloud Spanner | jdbc:cloudspanner:/projects/<project>/instances/<instance>/databases/<database>
|
CockroachDB |
CockroachDB on-premises:
CockroachDB cloud:
For more information, see Using Liquibase with CockroachDB. |
DB2 LUW | jdbc:db2://localhost:5432/yourdatabase
|
DB2 on z/OS | jdbc:db2://localhost:446/yourdatabase:retrieveMessagesFromServerOnGetMessage=true;
|
Firebird | jdbc:firebirdsql://localhost:3050//firebird/data/testdb
|
Hive | jdbc:hive2://localhost:10000/yourdatabase;UID=eselyavka;UseNativeQuery=1
|
HSQLDB | jdbc:hsqldb:hsql://localhost:9001/yourdatabase
|
Impala | jdbc:impala://localhost:21050/yourdatabase
|
Informix | jdbc:informix-sqli://localhost:9088/yourdatabase:INFORMIXSERVER=dbserver
|
InterBase | jdbc:interbase://localhost:3050/interbase/yourdatabase |
MariaDB |
MariaDB on-premises:
MariaDB cloud:
AWS example: |
MaxDB | jdbc:sapdb://localhost:7200/yourdatabase
|
MongoDB | jdbc:mongodb://localhost:27017/yourdatabase
|
MySQL | jdbc:mysql://localhost:3306/yourdatabase
|
Oracle |
Oracle on-premises:
Oracle cloud:
AWS example: |
Oracle ATP & ADW |
For more information, see Using Liquibase with Oracle ATP & ADW. |
PostgreSQL |
PostgreSQL on-premises:
PostgreSQL cloud:
AWS example: |
SAP HANA | jdbc:sap://localhost:30013/?databaseName=yourdatabase&encrypt=true
|
Snowflake |
AWS example: For more information, see Using Liquibase with Snowflake. |
SQL Server | jdbc:sqlserver://localhost:1433/yourdatabase
|
SQLite | jdbc:sqlite:yourdatabase
|
Sybase Anywhere | jdbc:jtds:sybase://localhost:5002/yourdatabase
|
Sybase Enterprise | jdbc:jtds:sybase://localhost:5432/yourdatabase
|
Teradata | jdbc:teradata://localhost/DATABASE=yourdatabase
|
Vertica | jdbc:vertica://localhost:5433/yourdatabase
|
VoltDB | jdbc:voltdb://localhost:21212
|
YugabyteDB | jdbc:postgresql://localhost:5433/yourdatabase
|
Related links
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK