0

Connecting to databases with jdbc url jdbc:postgresql://localhost:5432/mydatabase?currentSchema=myschema. Can I have multiple schemas in current schema

Subodh Joshi
  • 12,717
  • 29
  • 108
  • 202
Shruti Patil
  • 31
  • 1
  • 1
  • 7
  • https://stackoverflow.com/questions/8349267/hibernate-and-multi-tenant-database-using-schemas-in-postgresql – dwir182 Oct 11 '18 at 02:08
  • Possible duplicate of [Hibernate and Multi-Tenant Database using Schemas in PostgreSQL](https://stackoverflow.com/questions/8349267/hibernate-and-multi-tenant-database-using-schemas-in-postgresql) – Marcello B. Oct 11 '18 at 05:50
  • You could just try and see what happens. – Mark Rotteveel Oct 11 '18 at 08:49

1 Answers1

0

Yes. According to the Postgresql JDBC docs[1], you can provide multiple schemas to the currentSchema argument - separated by commas.

This is equivalent of the SQL statement SET SEARCH_PATH name1,name2,name3

Example,

jdbc:postgresql://localhost:5432/mydatabase?currentSchema=myschema,public,information_schema

However, this only sets the SEARCH_PATH to resolve unqualified object names.

  1. https://jdbc.postgresql.org/documentation/use/
Thomas Taylor
  • 1,311
  • 14
  • 15