• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to connect to a second database
PostPosted: Wed Jul 17, 2019 7:44 am 
Offline
New Member
New Member

Joined: Fri Oct 01, 2010 11:38 pm
Posts: 8
I want to use data from an alternative database in a UDT in CMSMS 2.2.10.

I have tried to connect it like this:
Code:
$alternativedb = array();
$alternativedbhost = '***';
$alternativedbuser = '***';
$alternativedbpswd = '***';
$alternativedbdbsn = '***';
$alternativedb = ADONewConnection('mysqli', 'pear:date:extend');
$alternativedb->Connect($alternativedbhost,$alternativedbuser,$alternativedbpswd,$alternativedbdbsn);
print_r($alternativedb);

However, the printed variable shows the information of the CMSMS database.

How can I connect to the other database?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to connect to a second database
PostPosted: Wed Jul 17, 2019 11:57 am 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 8145
Location: Fernie British Columbia, Canada
use \CMSMS\Database\Connection::Initialize();
you must provide it a \CMSSM\Database\ConnectionSpec object with your connection details.

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to connect to a second database
PostPosted: Wed Jul 17, 2019 12:23 pm 
Offline
New Member
New Member

Joined: Fri Oct 01, 2010 11:38 pm
Posts: 8
Thank you Robert, this is what I needed.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting