Connect to an external database

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Locked
fripsy
New Member
New Member
Posts: 3
Joined: Wed Jun 01, 2016 9:42 am

Connect to an external database

Post by fripsy »

Hi All,

I'm developing a custom module that has to fetch data from an external mysql database. By external I mean a database that resides on another server that is already used by users connecting to it from all over the world.

I was digging into the core adodb functions to find something that could put me on the right track.
The way I see it now, I would need to recreate (copy) the connect functions and modify them, so they are pointed to the external db.
The problem with this is, that I don't know how deep I will need to dig into the core to copy all those functions and modify them accordingly.

Is there another way to achieve an external connection?

Btw I'am on 2.1.3.

Thanks,
Frank.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1922
Joined: Mon Jan 29, 2007 4:47 pm

Re: Connect to an external database

Post by Jo Morg »

We are currently using a somewhat modified version of an external library, adodblite, you can find some docs here: http://adodblite.sourceforge.net/index.html
Connecting : http://adodblite.sourceforge.net/howtoinstall.php
In CMSMS 2.2 this will change though and that method will probably not work anymore. But to connect to an external db you can also use other valid PHP method: http://www.w3schools.com/php/php_mysql_connect.asp
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
fripsy
New Member
New Member
Posts: 3
Joined: Wed Jun 01, 2016 9:42 am

Re: Connect to an external database

Post by fripsy »

Thanks Jo Morg,

I think I'll go with the direct connection, as this reduces the change of breaking the module in case of a CMSMS update.

Cheers.
Frank.
Locked

Return to “Developers Discussion”