I have encrypted an SQLDB with SQLCipher...... in the terminal works without problem....
I am trying to open it in eclipse in an ANDROID enviroment, but without success....
I have tried all the possible examples findable on the internet without success.....
I put the database file in assets directory, is it right?
Sometimes the LogCat gives me db encrypted or is not a db and sometimes there is not such table (that I have tried to query)....
Can anyone help me?
I just would like to have an easy example, how to read and open a SQLCipher encrypted DB.
Thx
I have tried all the possible examples findable on the internet without success.
I am not aware of any examples of what you are trying to achieve.
I put the database file in assets directory, is it right?
That depends on what you are trying to do and the code that you are do it with.
My guess is that you are trying to package an encrypted database with your app, to use with SQLCipher for Android. This is useless, as anyone with the talent to get at the database will have the talent to either find your decryption key or find somebody else who can find your decryption key.
That being said, the best solution for doing this would be to port SQLiteAssetHelper to use SQLCipher for Android's classes rather than the standard SQLite classes. If you do this port yourself, you would package your database according to the SQLiteAssetHelper instructions, as a ZIP file in assets/.
I used SQLCipher in Android, but what I do is copy it to phone memory the first time and then use it as a normal SQLite database.
Is it a requirement that DB is located in assets folder?
Related
Is there any Android Official way of doing sql db backup to SD or Phone? there are several backup helper classes mentioned in the document but all of 'em are pretty useless.
I know that the sql file is a simple db file i can use Java IO class to read and write somewhere. but that is not a wise idea if we have latest version of App which contains several newly added columns in it. we cannot restore back.
Are there anyway to overcome this issue? Any easy way that so called android engineers provided in the document?
Have you seen the Backup Manager?http://developer.android.com/guide/topics/data/backup.html
Here is an article on how to use it with Gson.
https://advancedweb.hu/2015/01/06/efficient-sqlite-backup-on-android/
Not sure if this is the best solution but this will allow you to pick and choose the columns you want to restore.
I use the following approach:
make a copy of db file while back up.
Read that backup db file while restore using normal sqlite APIs.
Perform any operations like inserting default values for new columns if required and insert the data into the current db.You can perform the operations based on the version of db..The version of db can be encoded in the file name-something like backup_version_2.2.db
delete the backup db file
I see a sqllite database in another application, why can't I just just drag and drop from that application to mine in the eclipse environment? that way I can use data already in that database?
Android doesn't do too well with using an sqlite database file directly. Generally the way to go around it is to package an sqlite database as a resource and on first create of the app to load that resource and then connect to it and then copy all the data out of it. The downside of this is you are essentially doubling all your data.
If you are the publisher of the other app then you can list the database as a shared database to share between your apps.
Share SQLite database between 2 android apps?
Noone has written an Eclipse plugin that does that. You can write one if you feel it is both useful and worth your time.
I have a sqlite database in asset folder of my android project. I made it with sqlite database browser and use it in my project. It contains some table with 4 columns. This is working great in my apk file. But problem is if someone want he can easily break my apk file and get my real database also. Now my question is how can I protect my database? Is there any way to set password or encrypt my database.
I searched this type of problem in stackoverflow.com and found some way. But I think those ways are for, when I creating database with code. If I create database or put data with my program I would make my own encryption method also (like shuffling characters). But, again I am saying, my database is pre made and I want to protect this?
In this situation can you help me please? Sorry for bad English.
You can protect your database with help of following libraries. And make sure you use Pro-Guard to protect your code which has encryption keys.
SQL Cipher for Android but its paid library.
SQLite Encript
Android Database SQLCipher
Edit
You should check this blog and OI Safe also .. :)
You can integrate Proguard in your android app. Here is official documentation for this Proguard It will save your apk file from attack.
You can also encrypt your data in SQLite. You can apply AES Encryption to data beforing storing it to database and decrypt data in your code files before accessing it. Yo can also use SQL Cipher to protect your database
Check this Link it will help you
I am developing an app in android which consists of activities that need to connect to the Database. I am having an existing sqlite DB with me. But I don't know how to include it in my project. This might be a very basic question, but as I am a newbie, I am finding it quite complex to get it working. Any help would be appreciated.
The easiest solution, by far, is to use SQLiteAssetHelper. You add one JAR to your project, package your database in a ZIP file in a specified location in your project's assets/ directory, then use SQLiteAssetHelper to access your database (much like you would use SQLiteOpenHelper).
try to read more about making a DatabaseHelper extension class
this really helped me during my first database driven app
http://www.codeproject.com/Articles/119293/Using-SQLite-Database-with-Android
The name of this feature of transfer database in android called database Ship.
I have already complete database shipUsing your own SQLite database in Android applications
Also you can see this Stackoverflow Answer
Hello everyone first of all.
I am making an application for android, which I need to have a database for information.
The database management computer mailbox.
What I need is to take that database and included in the application for android'S SELECT generally.
I've been testing it on this website, but I can not get it to work. I do not think either the DB copy to memory, and then to perform the query, she says she can not find the table.
I have been debugged and saw that even the open works, but something strange happens ...
If you have some method or way of doing this, I would really appreciate it.
Thanks for everything.
Check out these resources
This tutorial by Lars Vogel
This reference article from Android website
Puit it in your assets directory in your apk, and on first use copy to "/data/data/YOUR_PACKAGE/databases/" directory. Here is SO discussion on this topic. database in assets folder