无法打开数据库“test.sql”:无法打开xcode中的数据库文件
我是新来的目标c。我试图创建在我的Mac第一次数据库我没有以下步骤无法打开数据库“test.sql”:无法打开xcode中的数据库文件
******100$ sqlite3 test.sql
SQLite version 3.7.5
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
但闻一进入.schema我收到以下错误
sqlite> .schema
Error: unable to open database "test.sql": unable to open database file
而且同样的错误,如果我去创建一个teble
您可以使用Firefox插件SQLite管理器来创建数据库。
尝试这样:
$ 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>
(这是从Linux的,但它应该是相同的...)
BTW文件扩展名.sql
是错误的;用于包含SQL语句的文件。改为使用.db
。
感谢*foe,但即使尝试了上面给出的内容,错误也是一样的 – 2012-08-10 08:31:55
@MudduPatil你是否在一个有写权限的目录中工作? – *foe 2012-08-10 08:38:26
ya我有所有的访问 – 2012-08-10 09:43:37
我开始怀疑你有test.sql'称为文本文件'和您正试图使用'sqlite3'命令行工具来打开它作为一个数据库... – *foe 2012-08-10 09:59:42
雅我得到它比thanx很多*foe – 2012-08-10 10:48:45