• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using PDO connect has error

#1
According to this document [link], following pdo setting will show an error:"Class '\CodeIgniter\Database\pdo\Connection' not found".

But, if i change to the default MySQLi setting that could work normally, i don't know what is wrong?

// use PDO
public $pdotest= [
        'DSN' => 'mysql:dbname=db1;host=localhost',
        'hostname' => 'localhost',
        'username' => 'root',
        'password' => 'xxxx',
        'database' => '',
        'DBDriver' => 'pdo',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug' => (ENVIRONMENT !== 'production'),
        'cacheOn' => false,
        'cacheDir' => '',
        'charset' => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre' => '',
        'encrypt' => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port' => 3306,
    ];

// use default mysql 5.7.24
public $default = [
        'DSN' => '',
        'hostname' => 'localhost',
        'username' => 'root',
        'password' => 'root',
        'database' => 'db1',
        'DBDriver' => 'MySQLi',
        'DBPrefix' => '',
        'pConnect' => false,
        'DBDebug' => (ENVIRONMENT !== 'production'),
        'cacheOn' => false,
        'cacheDir' => '',
        'charset' => 'utf8',
        'DBCollat' => 'utf8_general_ci',
        'swapPre' => '',
        'encrypt' => false,
        'compress' => false,
        'strictOn' => false,
        'failover' => [],
        'port' => 3306,
    ];
Reply

#2
It may not be clear enough in the user guide, but CI4 only has 3 database drivers so far: mysql, postgres & sqlite3.
It doesn't have a PDO driver.

This is mentioned in the roadmap, where we are trying to determine which drivers to build out next or which we need help with.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.