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   385 Views

Avatar
melatonin

21 March 2014 at 9:54pm Community Member, 6 Posts

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

22 March 2014 at 9:17am Forum Moderator, 1796 Posts

Hi,

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

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

Avatar
melatonin

24 March 2014 at 10:12pm Community Member, 6 Posts

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

Avatar
swaiba

24 March 2014 at 10:18pm Forum Moderator, 1796 Posts

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

25 March 2014 at 12:39am Community Member, 6 Posts

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?