• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to specify a schema for a DataSource?

 
James Adams
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Spring application which sets up a DataSource bean using standard properties such as URL, username, password, etc. I want to specify that this DataSource bean use a specific schema, but I can't find any information on how I can specify which schema I will be using through this DataSource. For example I have the production schema duplicated as a development schema, and I want to use the development schema for my development so I don't step on ay production data. How can I configure my DataSource so that the correct (development) schema is used for JDBC operations when I do my development and testing?

Thanks for any suggestions!


--James
 
Jan Cumps
Bartender
Posts: 2584
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by James Adams:
I want to specify that this DataSource bean use a specific schema, but I can't find any information on how I can specify which schema I will be using through this DataSource. For example I have the production schema duplicated as a development schema, and I want to use the development schema for my development so I don't step on ay production data. How can I configure my DataSource so that the correct (development) schema is used for JDBC operations when I do my development and testing?


Depends on the database you use, but in general:

You can create a test database account that points to your test schema,
and a production database account that points to your production schema.

Switching schemas can be done by selecting a different user in your DataSource setup.

What database are you using?

Regards, Jan
 
James Adams
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the schema used is tied to the account specified by the username and password properties. Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic