Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Runtime Development

Reply
New Contributor
tech247
Posts: 8
Registered: ‎10-11-2012
My Device: blackberry curve
My Carrier: airtel
Accepted Solution

database connection error in android runtime development

Hello  sir


my android project is running  normally but when i port it to blackberry it shows the error like that

 

01-01 14:22:57.946: I/Database(32850050): sqlite returned: error code = 1, msg = no such table: android_metadata
01-01 14:22:57.947: E/Database(32850050): SELECT locale FROM android_metadata failed
01-01 14:22:57.949: E/Database(32850050): Failed to setLocale() when constructing, closing the database
01-01 14:22:57.949: E/Database(32850050): android.database.sqlite.SQLiteException: no such table: android_metadata
01-01 14:22:57.949: E/Database(32850050):     at android.database.sqlite.SQLiteDatabase.native_setLocale(Native Method)
01-01 14:22:57.949: E/Database(32850050):     at android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:1987)
01-01 14:22:57.949: E/Database(32850050):     at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1855)
01-01 14:22:57.949: E/Database(32850050):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:820)
01-01 14:22:57.949: E/Database(32850050):     at com.whowantto_foot.DataBaseHelper.checkDataBase(DataBaseHelper.java:62)
01-01 14:22:57.949: E/Database(32850050):     at com.whowantto_foot.DataBaseHelper.createDataBase(DataBaseHelper.java:37)
01-01 14:22:57.949: E/Database(32850050):     at com.whowantto_foot.play.onCreate(play.java:144)
01-01 14:22:57.949: E/Database(32850050):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
01-01 14:22:57.949: E/Database(32850050):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
01-01 14:22:57.949: E/Database(32850050):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
01-01 14:22:57.949: E/Database(32850050):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-01 14:22:57.949: E/Database(32850050):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
01-01 14:22:57.949: E/Database(32850050):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-01 14:22:57.949: E/Database(32850050):     at android.os.Looper.loop(Looper.java:123)
01-01 14:22:57.949: E/Database(32850050):     at android.app.ActivityThread.main(ActivityThread.java:3687)
01-01 14:22:57.949: E/Database(32850050):     at java.lang.reflect.Method.invokeNative(Native Method)
01-01 14:22:57.949: E/Database(32850050):     at java.lang.reflect.Method.invoke(Method.java:507)
01-01 14:22:57.949: E/Database(32850050):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
01-01 14:22:57.949: E/Database(32850050):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
01-01 14:22:57.949: E/Database(32850050):     at dalvik.system.NativeStart.main(Native Method)

 

I counld not find why this is giving this type of error

 

Thanks in advance

 

Please use plain text.
Contributor
dhatchina
Posts: 11
Registered: ‎11-28-2012
My Device: Blackberry Playbook
My Carrier: Docomo

Re: database connection error in android runtime development

Hi,

   Are you copying database from assert folder at runtime or creating databse at runtime? 

 

If you are creating new DB at runtime, By default "android_metadata" table is created. 

If you are copying database from assert folder, you need to create that table. before packaging db with your application. create the "android_metadata" table using following SQL command "CREATE TABLE android_metadata (locale TEXT)". I thing this solution works for you.

 

 

Please use plain text.
New Contributor
tech247
Posts: 8
Registered: ‎10-11-2012
My Device: blackberry curve
My Carrier: airtel

Re: database connection error in android runtime development

I am using already created data and that is placed in asset folder . and
you are trying tell that i should create another database in asset folder name as android_metadata and move my all tables to android_metadata .. am i right ?
Please use plain text.
Contributor
dhatchina
Posts: 11
Registered: ‎11-28-2012
My Device: Blackberry Playbook
My Carrier: Docomo

Re: database connection error in android runtime development

Don't create new database, just create a "android_metadata" table in the current db or sqlite file.
Please use plain text.
New Contributor
tech247
Posts: 8
Registered: ‎10-11-2012
My Device: blackberry curve
My Carrier: airtel

Re: database connection error in android runtime development

i have already a table (android_metadata) and one column local type text in my database
any other idea ?
I am running my application in simulator 10 notebook in virtual machine
Please use plain text.
New Contributor
tech247
Posts: 8
Registered: ‎10-11-2012
My Device: blackberry curve
My Carrier: airtel

Re: database connection error in android runtime development

ok
your answer in running
thank you very very very very much......
Please use plain text.
Contributor
dhatchina
Posts: 11
Registered: ‎11-28-2012
My Device: Blackberry Playbook
My Carrier: Docomo

Re: database connection error in android runtime development

Try to add single record "en_US" in locate column
Please use plain text.
Developer
kpbird
Posts: 23
Registered: ‎01-05-2013
My Device: 9800
My Carrier: IDEA

Re: database connection error in android runtime development

Hello

There are two way to create database in Android

1. Create database using SQLHelper class
2. Create database in PC/Mac and put it in asset folder and when app start 1st time copy that database in /data/data/<package>/databases folder,

If you create db using 2nd option then you need to create android_metadata table


CREATE TABLE android_metadata (locale TEXT);
insert into android_metadata values(en_US);

User above sql statement to create meta tablet and insert one row in it.

Preferred way to create database is using option 1

Thank You
Please use plain text.