CodeIgniter Forums

Full Version: CI3 | Connect to remote database
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a web application with its own MariaDB database. But I also have to connect to another 2 databases that run on clients server (on premise server, normally not connected to internet). 

He told me, there are two ways how I could connect from my app to his server:
1. He enables some port of the server to be accessible from the internet 
2. Connecting to the server via VPN.

Once I will be connected to his server, I access the databases, run some stored procedures and get the result back to my server.
There are two different databases, one is Firebird and the second is MS SQL.

Is this even possible? How would you approach this problem? What way of connecting to the server would you prefer?

Btw, I need a real-time connection. 

Thank you! I will appreciate any suggestions.
I would prefer VPN all days of the week, it's the most secure option. Or I would build an API and install it on their servers (on a different server) and make that one public. Not exposing their database server directly to the internet.
(03-29-2020, 06:34 AM)jreklund Wrote: [ -> ]I would prefer VPN all days of the week, it's the most secure option. 
Thank you! VPN makes sense. So lets assume that I will connect via VPN.

I guess I will install VPN on my server and set the settings to connect to their server.
But how do I set my CodeIgniter app? Just add the database specifications in config? 
(I tried to Google "CodeIgniter VPN" but could not find anything relevant.)
You just put that servers local IP-adress instead of localhost/, it's not much too it really. The hard part are setting up the VPN connection itself. Either you install VPN server/client softare on your server or you set up a Site-to-site VPN connection in your firewalls. It depends on your infrastructure.

As you need to connect to a MS Server, you can't use SSH tunnels. And that's a shame.
Good. Many thanks. I will get back to this topic once I do some progress with it and will write here how I solved it.