This is a migrated thread and some comments may be shown as answers.

Multiple mysql connection

1 Answer 54 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Zbigniew Kozłowski
Top achievements
Rank 1
Zbigniew Kozłowski asked on 01 Sep 2010, 02:27 PM
Hi,
have can i switch mysql connect on start? i mean i got 1 mysql database but two seperate IP's i need to switch between those two IP's ofc i know how to detect which IP to use, but dont know how to swtich IP in ORM connection.
i've found http://www.telerik.com/community/forums/orm/general-discussions/support-multiple-databases.aspx but its with mssql and mysql, and also its for two seperate databases and i need it for 1 database but two IP ;)

1 Answer, 1 is accepted

Sort by
0
Serge
Telerik team
answered on 03 Sep 2010, 05:24 PM
Hello Zbigniew Kozłowski,

 What you need to do is just create two different connections for the different IP's. If you are using the new domain model approach the context constructor accepts a connection name so it would be as easy as adding a second connection string to the app.config of the executing project.

If you are using the classic wizards approach you have to add the new connection in the app.config. Then use code that looks like this to get an appropriate object scope:

IObjectScope scope1 = Database.Get("DatabaseConnection1").GetObjectScope();
IObjectScope scope2 = Database.Get("DatabaseConnection2").GetObjectScope();

I do hope this helps. Please do not hesitate to contact us back if you face further trouble or have any questions.

Best wishes,
Serge
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Zbigniew Kozłowski
Top achievements
Rank 1
Answers by
Serge
Telerik team
Share this question
or