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.

Share:
18,417

Related videos on Youtube

Andreas Selenwall
Author by

Andreas Selenwall

Updated on June 04, 2022

Comments

  • Andreas Selenwall
    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?

  • Andreas Selenwall
    Andreas Selenwall about 13 years
    Yes, I guess that is the way to do it. Thanks alot for your help, appreciate it.
  • Oly Dungey
    Oly Dungey over 6 years
    This example can not work for sql server as it doesn't support schemas in that way, please remove this solution.

Related