1. Taro L. Saito
  2. sqlite-jdbc
  3. Issues
Issue #83 new

"[SQLITE_ERROR] SQL error or missing database (near ".": syntax error)" when using "dot commands"

Anonymous created an issue

Are "dot commands" supported? I haven't been able to make them work with either of the statement.execute-types.

query.executeUpdate("create table "+tablename+" (name string, id integer);");
query.executeUpdate(".separator '\t'");
query.executeUpdate(".import "+path+" "+tablename);
ResultSet rs = query.executeQuery("select count(*) from "+tablename);

Especially the .import would be useful. The code crashes at the first line with a ".anything" (as far as I've tried the list from http://www.sqlite.org/sqlite.html), whether it is executeUpdate or just execute. (Even tried executeQuery, just in case.)

Error-dump for execute:

java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (near ".": syntax error)
    at org.sqlite.DB.newSQLException(DB.java:383)
    at org.sqlite.DB.newSQLException(DB.java:387)
    at org.sqlite.DB.throwex(DB.java:374)
    at org.sqlite.NativeDB.prepare(Native Method)
    at org.sqlite.DB.prepare(DB.java:123)
    at org.sqlite.Stmt.execute(Stmt.java:113)

Error-dump for executeUpdate:

java.sql.SQLException: near ".": syntax error
    at org.sqlite.NativeDB.throwex(NativeDB.java:210)
    at org.sqlite.NativeDB._exec(Native Method)
    at org.sqlite.Stmt.executeUpdate(Stmt.java:152)

As I am new to both SQLite and the JDBC, this might not be an issue at all. However, after some hours of searching I figured I'd just ask.


Comments (1)

  1. kristina1967

    Hello again,

    After a night's sleep I searched again and found this stackoverflow-answer: http://stackoverflow.com/a/10576066 which states that "dot commands" are indeed sqlite shell only.

    Another suggests "importing" data into a table by using a BufferedReader and just filling the table with the file's content: http://stackoverflow.com/a/6775780.

    Performance ... could be better, of course. Currently working on my smallest tab-seperated file (80 MB) and it's been going for some minutes. Good old "load data local infile x into table y" ...

  2. Log in to comment