Skip to content Skip to sidebar Skip to footer

"sqlite3: Error: Too Many Options: "into" " In Android Application

In my android application I am trying to use following line of code: Process runJob = Runtime.getRuntime().exec('sqlite3 /data/data/com.android.launcher/databases/launcher.db \'INS

Solution 1:

exec(String) splits the input on spaces and does not honor the " quotes like a shell would do.

Use exec(String[]) instead:

...exec(newString[] {
    "sqlite3",
    "/data/data/com.android.launcher/databases/launcher.db",
    "INSERT INTO favorites (column1, column2) VALUES(100,'someText');"
    });

(Not taking into account that what you're trying to do actually makes sense.)

Solution 2:

To avoid any conflicts in the insertion operations use insert with attributes and values as following:

Process runJob = Runtime.getRuntime().exec("sqlite3 /data/data/com.android.launcher/databases/launcher.db \"INSERTINTO favorites (column1, column2) VALUES(100,'someText');\"");

Post a Comment for ""sqlite3: Error: Too Many Options: "into" " In Android Application"