hashDefine
hashDefine

Reputation: 1491

SQLite: what is the path of my created-database?

I have downloaded the "Precompiled Binaries for windows" for the "SQLite" from here. I opened the command-line-shell and followed this, creating one table named "tbl1".

now I am looking at my desk trying to find the database file which contains tbl1, but I can't find it anywhere.

my question is: after creating a database in the SQLite, where the database file is stored ? i.e.: what is the path of my created-database ?

I am using windows7 and have basic knowledge about SQL and database

Upvotes: 0

Views: 540

Answers (2)

user2246674
user2246674

Reputation: 7719

By default (if no additional path is specified), the database is created in the current working directory.

That is, sqlite.exe ex1 creates the "ex1" database in the current directory. (Use cd from the same command shell to see what what the current working directory is.)

On the other hand, sqlite.exe C:\databases\ex1 would create the "ex1" database in the "C:\databases" directory.

To create the database on the desktop for the current user, something sqlite.exe "%USERPROFILE%\Desktop\ex1" should work. (This uses an environment variable called USERPROFILE which is expanded and used as part of the path.)

The same principle holds for any SQLite connection - the path to the database file is first resolved; either relative (as in the first case) or absolute (as in the second and third).

Upvotes: 1

Santosh Panda
Santosh Panda

Reputation: 7341

It creates the DB file in the given file path else by default it will create the file in your current working directory. If you can't find it then just search for the .db file inside your current project directory.

Upvotes: 1

Related Questions