0

is it possible to change the current working environment on runtime ?? what i want to do, is to load my application on a specific environment, and change it after somewhere in the code, is this possible ?

Ahmed Laatabi
  • 907
  • 1
  • 8
  • 21

1 Answers1

1

To a reasonable extent no. This would likely confuse the framework greatly and is not recommended.

Lauri Piispanen
  • 2,067
  • 12
  • 20
  • ah ok, what i want to do, is to change the working database at runtime, is there another way to do it ?? – Ahmed Laatabi Apr 19 '12 at 12:03
  • 1
    If you know your datasource before starting the app, and simply need to switch your domain classes from one to the other during runtime, check the multiple datasource feature from the documentation: http://grails.org/doc/2.0.0.RC1/guide/conf.html#multipleDatasources – Lauri Piispanen Apr 19 '12 at 12:33
  • As the above answer says, it is not recommended, and possibly you will run into issues. Can you give more details about what you are trying to achieve, you may get a better solution. – Sudhir N Apr 19 '12 at 13:50
  • Lauri : thanks sudhir : check my other post here : http://stackoverflow.com/questions/10225187/grails-start-the-application-without-connecting-to-database my idea is to create two environments, one with hdb to load the apllication, then switch to another environment with my db configured in the application. – Ahmed Laatabi Apr 19 '12 at 13:57