Page 1 of 1

Connect to an external database

Posted: Wed Jun 01, 2016 10:00 am
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.

Re: Connect to an external database

Posted: Wed Jun 01, 2016 11:07 am
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

Re: Connect to an external database

Posted: Wed Jun 01, 2016 11:15 am
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.