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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -