Connect to external database with PDO_DBLIB

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Locked
sandormatyas
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Tue Apr 20, 2021 8:56 am

Connect to external database with PDO_DBLIB

Post by sandormatyas » Wed Feb 23, 2022 1:58 pm

There is a Joomla 3.10.6 site and need to connect to an external MSSQL database via PDO_DBLIB and fetch some data
I usually use something like this for external databases
$option['driver'] = 'mysqli';
$option['host'] = 'remote.host';
$option['user'] = 'username';
$option['password'] = 'password';
$option['database'] = 'dbname';
$option['prefix'] = '';

but what about pdo_dblib?
I can find dblib in FOFDatabaseDriverPdo buthing more. Should I need to build my own FOFDatabaseDriverPdodblib class extending pdo? Or is there something already?

smartestlancer
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Thu Feb 24, 2022 10:21 pm

Re: Connect to external database with PDO_DBLIB

Post by smartestlancer » Thu Feb 24, 2022 11:03 pm

Hey,
Did you check the Joomla documentation for this?

https://docs.joomla.org/Connecting_to_a ... l_database

Let us know if this guide helps you!

Thanks

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30931
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Connect to external database with PDO_DBLIB

Post by Per Yngve Berg » Fri Feb 25, 2022 8:17 am

MSSQL database support is dropped from Joomla.

You can use the php functions. The server needs to have the php libraries for MSSQL database installed.

https://www.php.net/manual/en/function. ... t-info.php


Locked

Return to “Joomla! 3.x Coding”