I have a .sqlite file with one table in it. i want to access this data. Please tell me, where to copy this .sqlite file (in eclipse project) and how to access the data from this .sqlite file.
please suggest some code or liniks.. [i am using Android 2.1, dont know the database version..]
Thank you..
Here are a few articles that explain exactly that ;)
http://www.helloandroid.com/tutorials/how-have-default-database
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
Include a database file with Android application via Eclipse
Related
I'm new to Android and I have been trying to connect my SQLite db with DataGrip (because I already use it and I feel confortable with it).
I wanted to try this way but dropdown didn't show any Android SQLite option.
I also tried this way, but I couldn't find the .db file in my Android project.
Any help will be nice, thanks!
I found a way that is maybe a bit tricky and not helpful at all, but at least I can browse into the db:
Enter the Device File Explorer on Android Studio
Copy the database you need into your local folder (path is data/data//database.db)
Then enter datagrip and create a new data source (SQLite), using this file.
It's a really anoying way, because each time you make any changes, you need to re-copy the file, and sync your datasource. But anyway, it works.
I am developing an app in android which consists of activities that need to connect to the Database . I added my database file in assets folder which gets copied over to applications database directory on first time the app runs but "assets" directory and "data" directory(on rooted devices) can be accessed by any other application . I'm confusing between using database file or create database in code . If i create database in code it make the database file disappear in the "assets" folder . When users change the file extension from .apk to .zip ,database file will not appear in assest folder . What I should to do ?
Please give me some advice !
Both ways are good and useful it completely depends on your need.
By creating database in code you can secure your data from other applications but it will take so much pain to create it in that way so i suggest you to use a db or sqlite file in assets folder and while copying database on device or data folder use some security parameters to encrypt it or you can hide your app database folder on device so other applications and users will be not able to access it easily.
Well keeping Database in assets folder is not at all a bad practice plus it saves coding of creating a database , as far as you want to make it secure you have to do 2 things
1.keep you database in assests folder , and copy and save it in the internal memory , now its available only to your application and delete it from assests folder .
2.Use Proguard to protect it from somebody decompiling your application and obtaining the assests.
And yea if its a confidential data in the application and your application is worth it then you can also go for "encrypting data" but yea its a TDS task , see for yourself what suits you now.
Honestly, this is the best explained and a very complete tutorial on the subject
SQLite Android Tutorial
Don't get repulsive, because it's a bit longer one. Everything is explained nicely and you don't have to do the thinking about the location of your asset folder on different devices and so on...
In my app i have use .sqlite database when zip my .apk file and extract this one my all code and database file also is came.How to provide the security to my database file and source code any one please give any suggestion.
Thank u in advice.
So at a guess you are using a pre-populated SQLite database? You could use SQLCipher to encrypt the database - it works with pre-populated and new ones created by the app.
Trying to implement import and export feature in my application.Exporting is just copying of file in to the sd card. which i have done but importing is bit problematic. As importing should delete the previous rather the current database i am using and load the previous one.
I have gone through various post on this site regarding importing of sqlite database from sd card in application.Importing database,here there is an answer but i want to know when this method is to be called .? Or any other solution for this. would be really appreciated !
I feel this link will help you to find a solution basically you have to check whether you have included the permission in your manifest file to read and write external storage Device then follow the tutorial.
Refer this.. Using this you can club your db (.sqlite) in zip folder inside assests.
On installation it will unzip that & create the databse from your .sqlite file.
I am developing an android application where I need to export oracle database to .sql file (not as .dmp file). And then I will copy that .sql file to android assert folder. Now I will import that .sql file to sqlite db. But, I want to know how to export oracle db to .sql file.
Here I have two questions:
Is it possible to export oracle database to .sql file.
Is it possible to import the same .sql file from asserts to android SD Card as SQLite db.
Can someone please help me in solving these issues. Is there any tutorials or examples available that would be great help to me.
Thanks in advance.
you can use the DBMS_METADATA.GET_DDL() package to get your schema from the database that can be run to recreate the db object. Note not everything can be translated into sqllite depending on how complex your schema is. dbms_metadata reference Just spool the content to a file from sqlplus
See here. Oracle has these two tools called exp and imp for exporting a database and importing one. It will help transfer the database.
Edit: Even more info
How can I take the schema in Oracle and put it on another Computer?