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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Another DB Connection


Go to End


5 Posts   1753 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, 1899 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, 1899 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?