Saturday, February 25, 2012

Re: [android-developers] sqlite database storage data

I have create the database using below code.
db=openOrCreateDatabase("sip_
db.db",SQLiteDatabase.CREATE_IF_NECESSARY,null);
        db.setVersion(1);
        db.setLocale(Locale.getDefault());
        db.setLockingEnabled(true);

it is store data/data/my packaegnabe/databses
but i want to know the data from consol then i use the below command

[root@localhost ~]# cd /usr/src/android-sdk-linux/platform-tools
[root@localhost platform-tools]# ./adb shell
# cd data
# cd data
# cd com.example.android.sip
# cd databases
# ls
sip_db.db
# sqlite3 sip_db.db
SQLite version 3.6.22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from history;
1|9638095998||3:30
2|5002|30|
3|5003|30|3:30
5|5800|35|3:30
6|5700|35|3:30
7|5900|35|3:30
8|500|35|3:30
9|5|35|3:30
10|963-809-5999|35|3:30
11|5200|35|3:30


this way i got the data from table .But i want to know this is on my application or on pc based database.because when i run my project on other pc then at there in table there is no data.


On Sat, Feb 25, 2012 at 11:53 AM, Narendra Singh Rathore <nsr.curious@gmail.com> wrote:


On Sat, Feb 25, 2012 at 11:44 AM, Jagruti Sangani <jagruti.sangani@inextrix.com> wrote:
That i know but that data will remain with my project or on other pc i need to create database and insert data again.?


Hey Jagruti, I have solution for you.
You can store your database in assets folder, n copy it to your application folder through code, if it doesn't exist there. This will automatically copy your code to your application if it doesn't exist there.

Hope this will help you out.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment