I am new to the Liquibase. Hence, I need your suggestions and help on the following.
I want to use the SQL format to interact with PostgreSQL server /databases.
I am able to execute my sql script with single database successfully but I want to know how I can execute the same SQL script for multiple databases on the same server (Liquibase and Postgres is on the same machine).
Also, How we can interact to multiple Postgres servers incase liquibase is on different server/standalone machine.
The only thing that needs to change to deploy your liquibase changelogs to mulitple databases is the database jdbc string (and possibly the credentials). You will run a Liquibase “update” for each different database, changing the URL (jdbc string) between each execution.
Liquibase does not need to be installed on the database server, it just needs to be able to reach the database server (no firewall blocks).
Thanks for your prompt reply. I have deployed the changes to more than one database using below
liquibase --changelog-file=changelog5.sql --url=jdbc:postgresql://localhost:5432/test1 update
liquibase --changelog-file=changelog5.sql --url=jdbc:postgresql://localhost:5432/test2 update
liquibase --changeLogFile=changelog.sql --username=postgres --password=Postgres10 --classpath=/home/ec2-user/liquibase/internal/lib/postgresql.jar --url=jdbc:postgresql://localhost:5432/test1 update
But facing an issue while making changes to remote host. Could you please suggest on this ?
liquibase --changelog-file=changelog5.sql --url=jdbc:postgresql://18.104.22.168:5432/test_db2 update
What is the issue? unless you have a liquibase.properties file that contains the username and password, you also need to provide those when using the CLI.
I am getting below error message.
[ec2-user@ip-172-31-32-99 ~]$ liquibase --changelog-file=changelog5.sql --username=postgres --password=Postgres10 --url=jdbc:postgresql://22.214.171.124:5432/test_db2 update
Unexpected error running Liquibase: Connection could not be created to jdbc:postgresql://126.96.36.199:5432/test_db2 with driver org.postgresql.Driver. The connection attempt failed.
For more information, please use the --log-level flag
ok, that’s not really a Liquibase error. Are you able to connect to the database using psql?
Thanks. It is resolved after opening the port (added port in security group on AWS) between servers.