Welcome Guest, Not a member yet? Register   Sign In
Switching database
#1

[eluser]Computerzworld[/eluser]
Hello,
I am having 2 databases on different servers and I want to switch between these two databases for my application by using one link. So, whenever I click on 1st link the whole application should be switched over to 1st database and I should be able to add/edit/delete/view the data coming from the first database. Whenever I switch my database to 2nd the same way I should be able to add/edit/delete/view the data coming from the second database. In short whenever I click on the link that database should become active & I should be able to access it globally in any files. Is it possible to do so? Please help me. Thanks in advance.
#2

[eluser]rogierb[/eluser]
I would use the session to store what database to use, then use a pre-controller hook to load the database with the settings stored in the session.

Hope this helps;-)
#3

[eluser]Computerzworld[/eluser]
thanks for reply.. so.. exactly how can I switch over the database from first to second using pre-controller & session?
#4

[eluser]rogierb[/eluser]
1: create a pre controller hook that reads the session flasdata. If no data is set use default DB config and load DB
2: create a method that can set flasdata to the other database.
3: redirect to the page you where on

The precontroller will read the flahsdata and use the correct DB.
#5

[eluser]Computerzworld[/eluser]
thanks for reply.. i 'll try it...




Theme © iAndrew 2016 - Forum software by © MyBB