I am using SQLCipher 1.3 on Marshmallow Samsung S7.
I have created an SQLite/SQLCipher database/table using:
It successfully inserts a row into the table (after it has been created)
The next time it attempts to write to this table (5 seconds later the service executes that wrote successfully the first time) i get an error:
Any ideas why this might happen?
Regards,
Rusty
I have created an SQLite/SQLCipher database/table using:
B4X:
Sub CreateDatabase
If File.Exists(DBFolder, DBFile) = False Then 'Main.SDCard.SpecificData, StepDataDBFile) = False Then 'hasn't already been created
Try
File.Copy(File.DirAssets, "shellcipher.db3", DBFolder, DBFile) 'copy the cipher base file
Log("CREATED NEW DATABASE " & DBFolder & "/" & DBFile)
' MigrateSQLite(SQLSteps, Main.Version.SQLite)
Catch
Log("Shell copy Failed SD: " & DBFolder & "MDBR: " & DBFile)
End Try
End If
OpenDBF
End Sub
...
Sub OpenDBF
If ThisSQL.IsInitialized = False Then 'open the database
Try
ThisSQL.initialize(DBFolder, DBFile, False, SQLiteKEy, File.DirAssets)
' MigrateSQLite
Catch
Log("Not encrypted, or failed to open " & DBFolder & "/" & DBFile)
ThisSQL.initialize(DBFolder, DBFile, False, "", File.DirAssets)
End Try
End If
End Sub
It successfully inserts a row into the table (after it has been created)
B4X:
INSERT OR REPLACE INTO [StepData] ([FacilityID], [MRN], [TabletNo], [Today], [StepCount], [Distance], [Calories]) VALUES (?, ?, ?, ?, ?, ?, ?)
The next time it attempts to write to this table (5 seconds later the service executes that wrote successfully the first time) i get an error:
CheckTable (SQLiteException) net.sqlcipher.database.SQLiteException: file is encrypted or is not a database: , while compiling:
SELECT name FROM sqlite_master WHERE Type='table' and name ='StepData';
Any ideas why this might happen?
Regards,
Rusty