I'm a fresher of rails and SQLite.
Here is my scenario:
I had sqlite3
installed on my Windows Vista machine.
A blog application code had also been implemented at c:\rails\blog
.
I brought up my command prompt and went directly to c:\rails\blog\db
.
I ran the command sqlite3
to enter the database console.
when I used the .databases
command, no database was listed out? Why?
What have I done wrong?
When using the SQLite command line interface, you can use the . databases command to return a list of attached databases. More specifically, it returns the names and file names/location of each attached database.
Show databases in the current database connection To show all databases in the current connection, you use the . databases command. The . databases command displays at least one database with the name: main .
You probably didn't open the database itself
sqlite3 database.db
Remember, that in SQLite a database is just a file. As long as you don't open or attach one, there is no open one. On the other hand when you just open the database .databases
feels a kind of useless, because you know which one you just opened.
You must provide the database (path and) name to the sqlite3 command, e.g.,
Dev e$ sqlite3 my_test.db
SQLite version 3.7.7 2011-06-23 19:49:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .databases
seq name file
--- --------------- ----------------------------------------------------------
0 main /Users/e/Dev/my_test.db
sqlite>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With