CodeIgniter Forums
SQLite connect - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: SQLite connect (/showthread.php?tid=1341)



SQLite connect - mrdan32 - 03-01-2015

I'm using CI 3x to convert data from MySQL to SQLite to work on my mobile app.
My database config:

PHP Code:
$db['sqlite'] = array(
    
'dsn'    => '',
    
'hostname' => '',
    
'username' => '',
    
'password' => '',
    
'database' => '/Users/dudan/Documents/db_sqlite/db.jokes.sqlite',
    
'dbdriver' => 'sqlite3',
    
'dbprefix' => '',
    
'pconnect' => FALSE,
    
'db_debug' => TRUE,
    
'cache_on' => FALSE,
    
'cachedir' => '',
    
'char_set' => 'utf8',
    
'dbcollat' => 'utf8_general_ci',
    
'swap_pre' => '',
    
'autoinit' => TRUE,
    
'encrypt' => FALSE,
    
'compress' => FALSE,
    
'stricton' => FALSE,
    
'failover' => array(),
    
'save_queries' => TRUE
); 

The SQLite DB is SQLite 3. The message:

Code:
A Database Error Occurred

Unable to connect to your database server using the provided settings.



RE: SQLite connect - ngangchill - 03-01-2015

try this:


$db['sqlite'] = array(
'dsn' => '/Users/dudan/Documents/db_sqlite/db.jokes.sqlite',
'hostname' => '',
'username' => '',
'password' => '',
'database' => ''
'dbdriver' => 'pdo'
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'autoinit' => TRUE,
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);




it is.working fine in my projects...


RE: SQLite connect - mrdan32 - 03-02-2015

Thank you, I've solved it. It seem to be the file permission!

(03-01-2015, 01:37 PM)ngangchill Wrote: try this:    


$db['sqlite'] = array(
   'dsn'    => '/Users/dudan/Documents/db_sqlite/db.jokes.sqlite',
   'hostname' => '',
   'username' => '',
   'password' => '',
   'database' => ''
   'dbdriver' => 'pdo'
   'dbprefix' => '',
   'pconnect' => FALSE,
   'db_debug' => TRUE,
   'cache_on' => FALSE,
   'cachedir' => '',
   'char_set' => 'utf8',
   'dbcollat' => 'utf8_general_ci',
   'swap_pre' => '',
   'autoinit' => TRUE,
   'encrypt' => FALSE,
   'compress' => FALSE,
   'stricton' => FALSE,
   'failover' => array(),
   'save_queries' => TRUE
);




it is.working fine in my projects...