Using PDO connect has error |
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, ];
Does this mean we can not use PDO connections? I am trying to connect to an MSSQL 2008 server. It appears I can connect to it with the DSN string fully set and declare DBDriver as "MySQLi". However, does that route limit what I can do with manual queries? Can I still get array results, execute Stored PRocedures, and access Views?
That's correct, you cannot use PDO at this time. Don't use another engine for you server, it uses specific instruction not available for your server, and it may lead to corrupted data.
You can help out by testing and/or developing the driver: https://github.com/codeigniter4/CodeIgniter4/issues/503 |
Welcome Guest, Not a member yet? Register Sign In |