Sqlite3 is confused me fully ? What to give database extension (.db or .sqlite3)?

Hi all ,

I have create new application in rails with sqlite3 .

Its totally confusing to me when i see my database.yml file.

Reason of confusing is what type of extension is given to database ?

I have knowledge that by executing following line will create database :-

      sqlite3 test.db

See the extension of database is .db

But when i see my database.yml , extension of database is .sqlite3

database.yml is copied below.

What is extension of database in sqlite3 ?

In my database.yml file

SQLite version 3.x

gem install sqlite3

development:

adapter: sqlite3

database: db/development.sqlite3

pool: 5

timeout: 5000

Warning: The database defined as “test” will be erased and

re-generated from your development database when you run “rake”.

Do not set this db to the same as development or production.

test:

adapter: sqlite3

database: db/test.sqlite3

pool: 5

timeout: 5000

production:

adapter: sqlite3

database: db/production.sqlite3

pool: 5

timeout: 5000

Thanks

Best Regards

Fahim Babar Patel

Hi all ,

I have create new application in rails with sqlite3 .

Its totally confusing to me when i see my database.yml file.

Reason of confusing is what type of extension is given to database ?

I have knowledge that by executing following line will create database :-

      sqlite3 test.db

See the extension of database is .db

But when i see my database.yml , extension of database is .sqlite3

database.yml is copied below.

What is extension of database in sqlite3 ?

In my database.yml file

SQLite version 3.x

gem install sqlite3

development:

adapter: sqlite3

database: db/development.sqlite3

pool: 5

timeout: 5000

Warning: The database defined as “test” will be erased and

re-generated from your development database when you run “rake”.

Do not set this db to the same as development or production.

test:

adapter: sqlite3

database: db/test.sqlite3

pool: 5

timeout: 5000

production:

adapter: sqlite3

database: db/production.sqlite3

pool: 5

timeout: 5000

One more question how to switch database in Sqlite3.

In mysql we fire

use database_name

In postgre we fire

\c database_name

But what to fire in sqlite3 ?

Hi all ,

I have create new application in rails with sqlite3 . Its totally confusing to me when i see my database.yml file. Reason of confusing is what type of extension is given to database ?

I have knowledge that by executing following line will create database :-           sqlite3 test.db See the extension of database is .db

But when i see my database.yml , extension of database is .sqlite3 database.yml is copied below. What is extension of database in sqlite3 ?

You can use any extension you like. It is just a file.

man sqlite3 should show you.

Colin

Hi all ,

I have create new application in rails with sqlite3 .

Its totally confusing to me when i see my database.yml file.

Reason of confusing is what type of extension is given to database ?

I have knowledge that by executing following line will create database :-

      sqlite3 test.db

See the extension of database is .db

But when i see my database.yml , extension of database is .sqlite3

database.yml is copied below.

What is extension of database in sqlite3 ?

In my database.yml file

SQLite version 3.x

gem install sqlite3

development:

adapter: sqlite3

database: db/development.sqlite3

pool: 5

timeout: 5000

Warning: The database defined as “test” will be erased and

re-generated from your development database when you run “rake”.

Do not set this db to the same as development or production.

test:

adapter: sqlite3

database: db/test.sqlite3

pool: 5

timeout: 5000

production:

adapter: sqlite3

database: db/production.sqlite3

pool: 5

timeout: 5000

One more question how to switch database in Sqlite3.

In mysql we fire

use database_name

In postgre we fire

\c database_name

But what to fire in sqlite3 ?

man sqlite3 should show you.

One more question how to switch database in Sqlite3.

In mysql we fire

use database_name

In postgre we fire

\c database_name

But what to fire in sqlite3 ?

I do lots of google but i get nothing.

One more question how to switch database in Sqlite3.

In mysql we fire

use database_name

In postgre we fire

\c database_name

But what to fire in sqlite3 ?

I do lots of google but i get nothing.

You only have a single database in SQLite3, there is no need to select one.

Type “.help” inside the SQLite3 shell to learn more.

> > >> >> >> >> Hi all , >> >> I have create new application in rails with sqlite3 . >> Its totally confusing to me when i see my database.yml file. >> Reason of confusing is what type of extension is given to database ? >> >> I have knowledge that by executing following line will create database >> :- >> sqlite3 test.db >> See the extension of database is .db >> >> But when i see my database.yml , extension of database is .sqlite3 >> database.yml is copied below. >> What is extension of database in sqlite3 ? >> >> In my database.yml file >> SQLite version 3.x >> # gem install sqlite3 >> development: >> adapter: sqlite3 >> database: db/development.sqlite3 >> pool: 5 >> timeout: 5000 >> >> # Warning: The database defined as "test" will be erased and >> # re-generated from your development database when you run "rake". >> # Do not set this db to the same as development or production. >> test: >> adapter: sqlite3 >> database: db/test.sqlite3 >> pool: 5 >> timeout: 5000 >> >> production: >> adapter: sqlite3 >> database: db/production.sqlite3 >> pool: 5 >> timeout: 5000 >> > > > One more question how to switch database in Sqlite3. > In mysql we fire > use database_name > In postgre we fire > \c database_name > But what to fire in sqlite3 ?

man sqlite3 should show you.

One more question how to switch database in Sqlite3. In mysql we fire     use database_name In postgre we fire     \c database_name But what to fire in sqlite3 ? I do lots of google but i get nothing.

It is probably easiest just to exit sqlite3 and start it again on the other db.

Colin

Hi Fabian,

Go to yourapp/db

then you will see development.sqlite3 and test.sqlite3

Run

– sqlite3 development.sqlite3

– .databases

– .help

—.tables

check .help command you will know more commands on sqlite3

Thanks,

Saikiran Mothe

$ cd yourapp/db

$ sqlite3 develoment.sqlite3

$ .help

$ .databases

$ .use databasename

$ .tables

Well, not necessarily; see the ATTACH command.

Fabian,

You can Sqlite3 for development purpose,Its a lightweight database.for production you need to switch to postgresql,mysql,mongo.

Thanks,

Saikiran Mothe

Fabian,

You can Sqlite3 for development purpose,Its a lightweight database.for production you need to switch to postgresql,mysql,mongo.

Thanks,

Saikiran Mothe

$ cd yourapp/db

$ sqlite3 develoment.sqlite3

$ .help

$ .databases

$ .use databasename

$ .tables

Hi Fabian,

Go to yourapp/db

then you will see development.sqlite3 and test.sqlite3

Run

– sqlite3 development.sqlite3

– .databases

– .help

—.tables

check .help command you will know more commands on sqlite3

Thanks,

Saikiran Mothe

One more question how to switch database in Sqlite3.

In mysql we fire

use database_name

In postgre we fire

\c database_name

But what to fire in sqlite3 ?

I do lots of google but i get nothing.

You only have a single database in SQLite3, there is no need to select one.

Type “.help” inside the SQLite3 shell to learn more.

So over all which i understood is that in Sqlite we can use only one database at a time.

Is above statement is correct.

Thanks

Best Regards to All

Fahim Babar Patel

$sqlite3 develoment.sqlite3

use .sqlite3

No. Again, see the ATTACH command: ATTACH DATABASE

So over all which i understood is that in Sqlite we can use only one

database at a time.

Is above statement is correct.

No. Again, see the ATTACH command: http://www.sqlite.org/lang_attach.html

Attach database is different concept which you are saying ?

My question was

In mysql we fire below command

use database_name

In postgre we fire below command

\c database_name

But what to fire in sqlite3 to switch database?

@colin has given the answer is that you have exit open another database.

Waiting for your reply

Hope you will understood.

If you *read* the page I referred to, you'll see that you don't "switch" databases, you refer to the attached one(s) explicitly by name.

It works …

I attach development database to test.

I would think attaching the same db under a different name wouldn't be a great idea :slight_smile:

In any case, "name" and "file" seem pretty obvious; don't really know any use for "seq" offhand.