1

I'm new to objective c. I'm trying to create database for first time in my mac i did following steps

******100$ sqlite3 test.sql
SQLite version 3.7.5
Enter ".help" for instructions
Enter SQL statements terminated with a ";"

But wen i enter .schema I'm getting following error

sqlite> .schema
Error: unable to open database "test.sql": unable to open database file

And same error if i go to create a teble

Daniel
  • 23,129
  • 12
  • 109
  • 154
Muddu Patil
  • 91
  • 2
  • 12

3 Answers3

0

You can use Firefox addon SQLite Manager to create database.

Roxana
  • 38
  • 6
0

Try something like this:

$ sqlite3 test.sql
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> CREATE TABLE test (a_int INTEGER, a_real REAL, a_text TEXT);
sqlite> .schema
CREATE TABLE test (a_int INTEGER, a_real REAL, a_text TEXT);
sqlite> INSERT INTO test (a_int, a_real, a_text) VALUES (1, 1.24, 'hello world');
sqlite> SELECT * from test;
1|1.24|hello world
sqlite> 

(this was from Linux, but it should be the same...)

BTW the file extension .sql is wrong; that is used for a file containing SQL statements. Use .db instead.

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
0

Check this link for Create database, create table insert into table .

Creating an SQLite3 database file through Objective-C

Community
  • 1
  • 1
Vineesh TP
  • 7,755
  • 12
  • 66
  • 130