Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions /

Another DB Connection


Reply


5 Posts   433 Views

Avatar
melatonin

Community Member, 6 Posts

21 March 2014 at 9:54pm

Hi, i have a second mysql database (another host). i like to use it with ORM.
Someone has a little example to realize it.
Sorry, before i have never found one.

thank you

Avatar
swaiba

Forum Moderator, 1799 Posts

22 March 2014 at 9:17am

Hi,

I think this is what you are looking for...

http://www.silverstripe.org/customising-the-cms/show/13692#post293308

Avatar
melatonin

Community Member, 6 Posts

24 March 2014 at 10:12pm

Thank you.
But my plan is to use the intern ORM with a second database.
native sql statements are not my problem.

Avatar
swaiba

Forum Moderator, 1799 Posts

24 March 2014 at 10:18pm

There is no difference - once you have done the DB::connect you can use the ORM on whichever database it is (provided it is indeed of the right datamodel)

Avatar
melatonin

Community Member, 6 Posts

25 March 2014 at 12:39am

Thank you.
I understand what do you mean.
But how i can configure my DataObject Extension to my exist database struktur?
My table dont have the fields ClassName, Created, LastEdited. The primary key have a another name.
The creation on dev/build is not needed.
How i can solve the problems?