TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
DSN for Sqlite and usage (Kohana 3)
  • Hi there,

    I am trying to use a Sqlite database without ORM. My options in Database.php:

    'default' => array(
    'type' => 'sqlite',
    'connection' => array(
    'dsn' => 'sqlite:'.DBPATH.'Database.sqlite',
    'persistent' => FALSE,
    'table_prefix' => '',
    'charset' => 'utf8',
    'caching' => FALSE,
    'profiling' => TRUE,

    Anyway kohana will show an error:

    PDOException [ HY000 ]: SQLSTATE[HY000]: General error: 1 near "SET": syntax error

    You know what I am doing wrong?
    Any help would be very appreciated.

  • I haven't used pdo or sqlite. Are you using a sqlite database driver module? If not then shouldn't 'type' be 'pdo' so it uses the correct driver?

    Although from the error it seems like its connecting to sqlite ok. What does the query that it executes look like?
  • You're right, it should be "PDO". Now it works fine! Thank you for your help.
  • Hello,

    Setting type of connection to pdo and specifying DB path in dsn part ('dsn' => 'sqlite:application/data/plik.db') does not resolve this problem in my case (PDOException [ HY000 ]: SQLSTATE[HY000]: General error: 1 near "SET": syntax error).

    Additionally: if I specify database file which is not present (mistyped database file or something) then kohana creates empty file in proper directory, so I think that my database file path is set correctly.

    My version of Kohana is 3.0.8, any ideas will be appreciated.
  • try 'charset' => NULL,
  • +1 for changing 'charset' => 'utf8', to 'charset' => NULL, - that's what got it working for me.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion