Questions for using couchbase lite java - SQLiteException: no such table.

16 views
Skip to first unread message

Seungha Lee

unread,
Feb 16, 2017, 11:55:30 AM2/16/17
to Couchbase Mobile
Hello, I'm java desktop developer and want to deal with database encryptions.

So I found Couchbase-lite-Java version 1.3.1 and try to make it to work in my sqlite project.
(The project for trying to encrypt local database of my desktop application in Java.)

Also I'd like to try this with internal apis of com.couchbase.lite.internal.

But I stocked for an issue like below..

Database file was created successfully with below codes but the table what I want to create is not generated.

Is there an options that I missed?

Please check below..

com.couchbase.lite.internal.database.sqlite.exception.SQLiteException: no such table: CLIENTS (code 1): , while compiling: SELECT * FROM CLIENTS

SQLiteDatabase.setDatabasePlatformSupport(new DatabasePlatformSupport() {
@Override
public boolean isMainThread() {
return false;
}
});
database = SQLiteDatabase.openDatabase(
System.getProperty("user.dir") + "/" + dbName, null,
SQLiteDatabase.CREATE_IF_NECESSARY |SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING | SQLiteDatabase.OPEN_READWRITE,
4, null, this);

// try to create some table
database.execSQL("CREATE TABLE IF NOT EXISTS CLIENTS ( SomeValue INTEGER PRIMARY KEY, OtherValue INTEGER NOT NULL)"); // no exceptions.
// try to select some clients
database.rawQuery("SELECT * FROM CLIENTS", null); // no such table exception.

Jens Alfke

unread,
Feb 16, 2017, 12:11:48 PM2/16/17
to mobile-c...@googlegroups.com
You’re trying to use an internal sub-package of Couchbase Lite in your own app? That doesn’t seem likely to work; those packages aren’t designed to be used independently.

If what you want is database encryption, just use SQLCipher; that’s what we use to encrypt SQLite databases.

—Jens
Reply all
Reply to author
Forward
0 new messages