java - Change schema dynamically -
how can set postgres schema dynamically in java? tried doing:
this.getdatasource().getconnection().setschema("myschema"); i using spring-jdbc , this jdbcdaosupport instance.
note: don't want go database twice, set search_path not solve problem efficiently.
run statement:
set schema 'myschema'; to change current schema
or set search path, can access tables in e.g. public , myschema:
set search_path public, myschema; (note difference in how specify schema name in 2 statements: first 1 has use single quotes, second 1 not)
you can change search path permanently specific user, using alter user....
Comments
Post a Comment