tags:

views:

178

answers:

2

I tried using the following commands to create a database file at prompt, but none of them would work.

$ sqlite3 test.db
sqlite3 test.db
test.db

does it require a semi-colon at the end or is it that hard to create a database file using sqlite3 prompt?

Edit:

When I start the sqlite3 prompt, I get

SQLite version 3.6.22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

when type "sqlite3 test.db" I get,

SQLite version 3.6.22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> sqlite3 test.db
   ...>

where should be the test.db file on the disk?

A: 

That's strange, simply typing

sqlite3 test.db

Should create the sqlite database it does for me, does it show any errors?

When it use that command I get the following output

$ sqlite3 test.db
SQLite version 3.6.12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> 

Which is the sqlite command line interface

In response to your edit you need to type sqlite3 test.db from your command line not from inside the sqlite prompt.

When you type it in your command prompt it will create the database in the directory where you are working and open the sqlite command prompt.

Obsidian
A: 

It sounds like your Environment Variables haven't been setup to use SQLite3. Now I'm not sure of your OS, but here's how to set it under WinXP:

  • Start -> Right-click 'My Computer'
  • Select 'Properties'
  • Select the 'Advanced' tab
  • Click 'Environment Variables'
  • (Under 'System Variables') Select 'Path'
  • Click 'Edit'
  • (Under 'Variable Value') Go to the end of the line and enter the path to your sqlite3.exe (minus sqlite3.exe) For example: C:\bin\sqlite3\;

And that's it! But remember that each path under 'Variable Value' is separated by a semi-colon, so make sure there is one before your new path.

artificial