How to specify schema for SQL Server in JDBC Spring configuration
18,417
I don't think it's possible to specify the schema since this is a function of the user, not the JDBC session. You should probably create a user with their default schema set to each schema you want to use, and then specify the user in the dbcp configuration.
Related videos on Youtube
Author by
Andreas Selenwall
Updated on June 04, 2022Comments
-
Andreas Selenwall almost 2 years
We are using the org.apache.commons.dbcp.BasicDataSource as parent class for our datasources in Spring.
Is it possible to specify which schema to use in either the "url" or in another property in the DBCP datasource?
-
Michael Böckling over 9 yearsThat is for DB2, I don't think it works for SQL Server, as currentSchema is not listed in the available properties: msdn.microsoft.com/en-us/library/ms378988.aspx
-
-
Andreas Selenwall about 13 yearsYes, I guess that is the way to do it. Thanks alot for your help, appreciate it.
-
Oly Dungey over 6 yearsThis example can not work for sql server as it doesn't support schemas in that way, please remove this solution.