Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14114

SQLSTATE[08006] [7] invalid connection option "charset"

$
0
0
Hello 

I'm trying to connect with PDO to my database. 

Here is the error message : 
A Database Error Occurred
SQLSTATE[08006] [7] invalid connection option "charset"
Filename: controllers/HomeController.php
Line Number: 10

The HomeController : 

PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');

class 
HomeController extends CI_Controller {

 
 

    public 
function __construct()
 
   {
 
       parent::__construct(); 

And the data base : 

PHP Code:
$active_group 'default';
$query_builder TRUE;

$db['default'] = array(
    
'dsn'    => 'pgsql:host=localhost; dbname=xxx; charset=utf8;',
    
'hostname' => 'localhost',
    
'username' => 'root',
    
'password' => 'root',
    
'database' => '',
    
'dbdriver' => 'pdo'
    
'dbprefix' => '',
    
'pconnect' => FALSE,
    
'db_debug' => (ENVIRONMENT !== 'production'),
    
'cache_on' => FALSE,
    
'cachedir' => '',
    
'char_set' => 'utf8',
    
'dbcollat' => 'utf8_general_ci',
    
'swap_pre' => '',
    
'encrypt' => FALSE,
    
'compress' => FALSE,
    
'stricton' => FALSE,
    
'failover' => array(),
    
'save_queries' => TRUE
); 

It worked with mysql but I'd like to be able to use PDO. 

Any help ? 

Thank you, 
Martin. 

Viewing all articles
Browse latest Browse all 14114

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>