Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configured symfony2 with sqlite

I am working on my test application in symfony2 with sqlite. I have install symfony2 and trying to setup with sqlite, I have create 'data' folder under 'src/test' test namespaces, but when I run command

app/console doctrine:database:create 

Its giving error :

Could not create database for connection named data/ak.db
SQLSTATE[HY000] [14] unable to open database file

My Parameter.yml settings are :

parameters:
    database_driver: pdo_sqlite
    database_host: localhost
    database_port: null
    database_name: ak.db
    database_user: root
    database_password: null
    mailer_transport: smtp
    mailer_host: localhost
    mailer_user: null
    mailer_password: null
    locale: en
    secret: b4289c0b750d5c5b573788d79c4e1d130380ff7d
    database_path: data/ak.db

and config.yml :

# Doctrine Configuration
doctrine:
    dbal:
        driver:   %database_driver%
        host:     %database_host%
        port:     %database_port%
        dbname:   %database_name%
        user:     %database_user%
        password: %database_password%
        path:     %database_path%
        charset:  UTF8
like image 367
Alok Avatar asked Dec 01 '25 09:12

Alok


1 Answers

The database 'path' parameter has to list the full path to the database. In your case, you can do:

doctrine:
    dbal:
        path: %kernel.root_dir%/src/test/%database_path%
like image 115
Carlos Granados Avatar answered Dec 02 '25 23:12

Carlos Granados