1

I have two databases one is SQLite db_1 and the other SQLCipher db_2. I want to move a table from db_1 to db_2.

Since I am using SQLCipher in one of the databases, I can't ATTACH the databases and copy Table and its contents from one to the other.

Is it possible with either database queries or Android Code or both to somehow move the table to db_2 and then delete Table in db_1 in onUpgrade().

Note :

When trying to ATTACH the database I got the following error

Failure 26 (file is encrypted or is not a database) on 0xab61cb98 when executing 'ATTACH DATABASE '/data/data/com.example/databases/DATABASE.db' AS DB;'
Abbas
  • 3,529
  • 5
  • 36
  • 64
  • Why can't you use ATTACH? Doesn't SQLCipher add the KEY option? – CL. Jan 31 '17 at 09:23
  • @CL. Because `db_1` and `db_2` are two different types of databases. I assumed attempting to attach a non-encrypted database in an encrypted one or vice versa should not be possible. Am I wrong? – Abbas Jan 31 '17 at 09:38
  • I don't know; I've never used SQLCipher. But why didn't you try? – CL. Jan 31 '17 at 09:39
  • @CL. simply seemed illogical, I will however try and let you know. – Abbas Jan 31 '17 at 09:43
  • @CL. Just tried `ATTACH`, didn't work. Got the error added in question. – Abbas Jan 31 '17 at 12:31
  • I asked for ATTACH with KEY. – CL. Jan 31 '17 at 13:13
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/134483/discussion-between-abbas-and-cl). – Abbas Jan 31 '17 at 13:26
  • @CL. Tried ATTACH with Key, got essentially the same error `android.database.sqlite.SQLiteDatabaseCorruptException: file is encrypted or is not a database (code 26)`. – Abbas Feb 01 '17 at 07:07

0 Answers0