I'm making a backup App for my different messengers.
The App copies (on rooted phones) the db files from each App, modifies the db to make it lighter, uploads with FTP and a PHP scripts copies data to a Mysql database.
Everything works just fine but the whatsapp Smileys.
When I open msgstore.db file on my android device with a SQLite reader in the "data" field (text) I see the smiley image, not a text equivalent (like in other Apps that I see things like (: )
When I open the db file in my computer I see a square like char. 😊
And when I open mysql I see nothing. Like if no data was uploaded.
What is really stored in that field as a smiley? How can I see it in my computer? How can I get it to mysql?
You will need to change your database to use utf8mb4. I think you will find the following very useful for updating your tables to use ths char set. My guess is when you've restored the database they have defaulted to incorrect char sets.
https://mathiasbynens.be/notes/mysql-utf8mb4
Related
Decompile this app or this. You can't see the database(words, Synonym or ...). I wrote a dictionary app and my words are in the SQLite database. After decompiling the app, the person can see the database (words or ...).
How do I hide the database? Like Oxford Dictionary and other dictionaries?
Do these apps use SQLite?
Did I convey my mean clearly?
If you want offline data, you have to encrypt your database. Use a database that you can encrypt, such as Sqlite. DB Browser for Sqlite will help you encrypt your database.
https://sqlitebrowser.org/
Or if you want an online database, then you have to use a backend such as Firebase or Amazon AWS.
You have one option:
Store your words online (in Firebase for example) at first launch you download all the words and store it on SQLite (or Room database) and you are ready to go. By using remote server the download size of your apk also become smaller!
I want to upload local sqlite database file at server but in sql format. Is it possible to directly save it in mysql supported format? The file is uploaded successfully on server but its just a flat file of sqlite db. When i open it in editplus or import it in phpmyadmin, it shows error. But when I manually export the database from sqlite manager in .sql extension, it successfully gets open in readable format in editplus. Please help me with this problem. Thanks in advance !
AFAIK you are talking about two completely different things.
Its like comparing a DB dump file to a properly exported file like an xml file with schema and data information from Oracle or MySql
When you export you get a file with or without .sql extension and it means a file with set of queries like DDL or DML create,insert etc. That may be sequentially run to execute all the commands in it and provide you with the right schema and data present in that file.
Whereas a DB file that is created via app is specific to the device and is an .sqlite file which is specific to sqlite browser and that may read it and not a set of queries only that you may open in edit-plus or a text editor.
Sqlite DB file that you find on your device is dynamically generated pages to maintain the integrity of the db.
For more info you must read,
Format of sqlite database
Sorry I don't have code but the idea is,
--Edit with algo--
Assuming you have the create commands for all tables and constraints with you , as they are not going to change most of the time.
You may use this function as a Utility to create and maintain the sql
command list for you parallel to the db you have.
void createExportCommands()
{
...
- Read all tables one by one using a `Cursor`
- Based on specific tables/columns create queries
i.e. String query="insert into "+your_table+" values("+cursor.getString(0),....+");";
- Write this data into a file called export_data.sql and keep updating it in background
}
Perhaps its not the best approach but it will solve your issue.
I have created a database android application it works correctly on emulator , but when Iam transferring it to my device it says that the table is not exist ,I have used 'openOrCreateDatabase() ' method , the database doesnt come with apk file ,when I run the ap, my database is read only, means I already have a lot of data in it and only need to see them
Things in your apk file such as assets are read only so you can't use it as a live database. If you have data already in sqlite database, you will have to copy the data into the live database. If on the other hand you have it in some other format such as csv, you will have to create a reader which will add it into your live database.
i need hints for SQLite; I receive in SOAP or REST format a large XML (betwen 200 and 5000 entries depending on the user, with around 30 columns) that i parse to a local SQLite db.
This operation takes too much time for the users (from 10 seconds up to 2 minutes), so i wanted to know :
Is it possible under a window server (Delphi XE2 home made server) to create the SQLite database file and send the whole file to the mobile; Then on mobile side, replace the database file with the new one (data are not modified on client side, i can replace file with no regrets ^^ ) ?
On a rooted mobile, i just can't find the SQLite database file (searched for it with esFileExplorer, /data, /dbdata, /sdcard/data... nowhere) so i just don't know where i will have to put that file in the end...
Yes, its possible.
You can download the database having latest data & replace it with current database. Find an example here of "How to use existing data base", link for sample project is also there.
EDIT:
You need to modify it according to your needs.
You can delete your existing database by using context.deleteDatabase(DATABASE_NAME);
I want to only read data from the SQLite database. When I am creating database and reading it it is working but I have already a database created and I want to read data from this database.
I am pushing the database to the sdcard and trying to run the application but it is not reading form the database. I want to know that if install this .apk file in device then my database will also shift to the device or not.
Common practice is to store initial data on assets/raw folders of application resources. Then during 1st run just create DB using SQL scripts like:
create table if not exist
Fill DB with initial data - and here you're.