Is it possible to specify the schema when connecting to postgres with JDBC?
I know this was answered already, but I just ran into the same issue trying to specify the schema to use for the liquibase command line.
UpdateAs of JDBC v9.4 you can specify the url with the new currentSchema parameter like so:
jdbc:postgresql://localhost:5432/mydatabase?currentSchema=myschema
Appears based on an earlier patch:
Which proposed url's like so:
jdbc:postgresql://localhost:5432/mydatabase?searchpath=myschema
As of version 9.4, you can use the currentSchema
parameter in your connection string.
For example:
jdbc:postgresql://localhost:5432/mydatabase?currentSchema=myschema
If it is possible in your environment, you could also set the user's default schema to your desired schema:
ALTER USER user_name SET search_path to 'schema'