*Here is the logcat, i got this when i changed the table name n hence
created a new table
also tell me how to wipe out the data from the database so that i can clear
all the tables*

09-02 09:41:51.778: ERROR/Database(710): Leak found
09-02 09:41:51.778: ERROR/Database(710): java.lang.IllegalStateException:
/data/data/com.android/databases/myDatabse.db SQLiteDatabase created and
never closed
09-02 09:41:51.778: ERROR/Database(710):     at
android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1580)
09-02 09:41:51.778: ERROR/Database(710):     at
android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:638)
09-02 09:41:51.778: ERROR/Database(710):     at
android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:659)
09-02 09:41:51.778: ERROR/Database(710):     at
android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:652)
09-02 09:41:51.778: ERROR/Database(710):     at
android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:463)
09-02 09:41:51.778: ERROR/Database(710):     at
android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:181)
09-02 09:41:51.778: ERROR/Database(710):     at
com.android.DatabaseWork.tryThis(DatabaseWork.java:35)
09-02 09:41:51.778: ERROR/Database(710):     at
com.android.DatabaseWork.onCreate(DatabaseWork.java:21)
09-02 09:41:51.778: ERROR/Database(710):     at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
09-02 09:41:51.778: ERROR/Database(710):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
09-02 09:41:51.778: ERROR/Database(710):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
09-02 09:41:51.778: ERROR/Database(710):     at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
09-02 09:41:51.778: ERROR/Database(710):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
09-02 09:41:51.778: ERROR/Database(710):     at
android.os.Handler.dispatchMessage(Handler.java:99)
09-02 09:41:51.778: ERROR/Database(710):     at
android.os.Looper.loop(Looper.java:123)
09-02 09:41:51.778: ERROR/Database(710):     at
android.app.ActivityThread.main(ActivityThread.java:3948)
09-02 09:41:51.778: ERROR/Database(710):     at
java.lang.reflect.Method.invokeNative(Native Method)
09-02 09:41:51.778: ERROR/Database(710):     at
java.lang.reflect.Method.invoke(Method.java:521)
09-02 09:41:51.778: ERROR/Database(710):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
09-02 09:41:51.778: ERROR/Database(710):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
09-02 09:41:51.778: ERROR/Database(710):     at
dalvik.system.NativeStart.main(Native Method)
09-02 09:41:51.878: ERROR/Database(710): Leak found
09-02 09:41:51.878: ERROR/Database(710): java.lang.IllegalStateException:
/data/data/com.android/databases/myDatabse.db SQLiteDatabase created and
never closed
09-02 09:41:51.878: ERROR/Database(710):     at
android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1580)
09-02 09:41:51.878: ERROR/Database(710):     at
android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:638)
09-02 09:41:51.878: ERROR/Database(710):     at
android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:659)
09-02 09:41:51.878: ERROR/Database(710):     at
android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:652)
09-02 09:41:51.878: ERROR/Database(710):     at
android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:463)
09-02 09:41:51.878: ERROR/Database(710):     at
android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:181)
09-02 09:41:51.878: ERROR/Database(710):     at
com.android.DatabaseWork.tryThis(DatabaseWork.java:35)
09-02 09:41:51.878: ERROR/Database(710):     at
com.android.DatabaseWork.onCreate(DatabaseWork.java:21)
09-02 09:41:51.878: ERROR/Database(710):     at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
09-02 09:41:51.878: ERROR/Database(710):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
09-02 09:41:51.878: ERROR/Database(710):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
09-02 09:41:51.878: ERROR/Database(710):     at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
09-02 09:41:51.878: ERROR/Database(710):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
09-02 09:41:51.878: ERROR/Database(710):     at
android.os.Handler.dispatchMessage(Handler.java:99)
09-02 09:41:51.878: ERROR/Database(710):     at
android.os.Looper.loop(Looper.java:123)
09-02 09:41:51.878: ERROR/Database(710):     at
android.app.ActivityThread.main(ActivityThread.java:3948)
09-02 09:41:51.878: ERROR/Database(710):     at
java.lang.reflect.Method.invokeNative(Native Method)
09-02 09:41:51.878: ERROR/Database(710):     at
java.lang.reflect.Method.invoke(Method.java:521)
09-02 09:41:51.878: ERROR/Database(710):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
09-02 09:41:51.878: ERROR/Database(710):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
09-02 09:41:51.878: ERROR/Database(710):     at
dalvik.system.NativeStart.main(Native Method)




On Wed, Sep 2, 2009 at 9:41 AM, Bharath B.G. <[email protected]>wrote:

> Hi,
>
> i put the code inside the try catch block and the error is bcoz of
> tables(there may be other errors too but first i hav to remove this error)
> now my question is where exactly is the database files, where they get
> stored...? in workspace or system32 folder or where...? bcoz i couldnt find
> the files anywhere, and how can i completely delete all the tables, so that
> i can create the database from the start
>
> regards
> Bharath BG
>
>
> On Tue, Sep 1, 2009 at 6:01 PM, leonardo. <[email protected]>wrote:
>
>> You can put a
>> try {
>> db.execSQL("create table myTable (id integer primary key, name text not
>> null);");
>> } catch(Exception e) {}
>>
>> to try to see the error??
>>
>> 2009/9/1 Bharath B.G. <[email protected]>
>>
>> Hi, I am very new to SQLite, i referred some books regarding coding in
>>> SQLite n went straight for coding
>>>
>>> But while i run my simple code i am getting error "the application has
>>> stopped unexpectadly" (particularly in the line create table)
>>>
>>> please tell me where exactly is the error n where i hav to modify the
>>> code
>>>
>>>
>>>
>>> package com.android;
>>>
>>> import android.app.Activity;
>>> import android.content.Context;
>>> import android.database.Cursor;
>>> import android.database.sqlite.SQLiteDatabase;
>>> import android.os.Bundle;
>>> import android.widget.EditText;
>>>
>>> public class DatabaseWork extends Activity {
>>>
>>> private EditText et;
>>>
>>> public void onCreate(Bundle icicle) {
>>> super.onCreate(icicle);
>>>
>>> setContentView(R.layout.main);
>>> et=(EditText)findViewById(R.id.EditText01);
>>>
>>> tryThis();
>>> }
>>>
>>> public void tryThis()
>>> {
>>> final String DATABASE_NAME="myDatabse.db";
>>> final String DATABASE_TABLE="myTable";
>>> final int DATABASE_VERSION=1;
>>>
>>> final String COL_NAME="name";
>>> final String COL_ID="id";
>>>
>>> SQLiteDatabase db;
>>>
>>> db=openOrCreateDatabase(DATABASE_NAME, 0, null);
>>> db.execSQL("create table myTable (id integer primary key, name text not
>>> null);");
>>>
>>> db.execSQL("insert into myTable values (1, \"Bharath\");");
>>> db.execSQL("insert into myTable values (2, \"Abhijith\");");
>>>
>>> Cursor c=db.query(DATABASE_TABLE, new String[] { COL_ID,COL_NAME}, null,
>>> null, null, null, null);
>>>
>>> int idCol=c.getColumnIndex(COL_ID);
>>> int nameCol=c.getColumnIndex(COL_NAME);
>>>
>>> String s=null;
>>>
>>> while(true)
>>> {
>>> String name=c.getString(nameCol);
>>> s=s+" "+name;
>>> if(c.isLast())
>>> {
>>> break;
>>> }
>>> c.moveToNext();
>>> }
>>>
>>> et.setText(s);
>>>
>>> db.close();
>>> }
>>> }
>>>
>>>
>>> --
>>> Bharath B.G.
>>>
>>>
>>>
>>
>>
>> --
>> Leonardo Ribeiro
>> Desenvolvedor Java - iFactory Solutions
>> SCJP 1.5
>>
>>
>>
>> >>
>>
>
>
> --
> Bharath B.G.
>



-- 
Bharath B.G.

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

Reply via email to