PDO driver not working

100 views
Skip to first unread message

Dodinz Ballecer

unread,
Oct 1, 2014, 5:41:16 AM10/1/14
to joomla-dev...@googlegroups.com

Hello,

I tried to use the PDO driver for my 2nd database connection by setting this code to my model class:

$option['driver'] = 'pdo'; // Database driver name
$option['dsn'] = 'DSNname';

$option['host'] = 'xx.xx.xx.xx'; // Database host name
$option['port'] = '1433'; // Database host name
$option['user'] = 'sa'; // User for database authentication
$option['password'] = '$$$$$$$$$'; // Password for database authentication
$option['database'] = 'myDB'; // Database name
$option['prefix'] = ''; // Database prefix (may be empty)

$db = JDatabase::getInstance( $option );
parent::setDbo($db);

But prompted me an error : Fatal error: Cannot instantiate abstract class JDatabaseDriverPdo

Just wanted to ask if this driver is still on the development progress?

Thanks in advance! :)

Omar Ramos

unread,
Oct 1, 2014, 5:11:00 PM10/1/14
to Joomla! Framework Development
Hi Dodinz,

While there is a PDO Driver class, it is abstract as you noted in your error message so it's actually meant to be extended so that a specific PDO Driver class is available for the database type you want to use.

For example, the Oracle driver builds on top of the PDO class and for the $option['driver'] line you would type the following instead:
$option['driver'] = 'oracle';

Which type of database are you wanting to connect to?

-Omar



--
Framework source code: https://github.com/joomla-framework
Visit http://developer.joomla.org for more information about developing with Joomla!
---
You received this message because you are subscribed to the Google Groups "Joomla! Framework Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-frame...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-framework.

Reply all
Reply to author
Forward
0 new messages