-1

I've been trying to get an android app to connect to a database that's located on localhost, but I've been having no luck so far. My program used to be able to boot up and I could enter text into the text fields, but once I've made a few changes, it won't even boot up now. I've looked through LogCat and I have no idea what the problem could be. I'm sort of new at this, think anyone out there could help me?

Here's my error log from LogCat:

08-08 20:31:35.367: E/AndroidRuntime(605): FATAL EXCEPTION: main
08-08 20:31:35.367: E/AndroidRuntime(605): java.lang.RuntimeException: Unable to start activity     ComponentInfo{com.example.databasetester/com.example.databasetester.DashboardActivity}: android.database.sqlite.SQLiteException: no such table: users: , while compiling: SELECT  * FROM users
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2049)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2083)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.app.ActivityThread.access$600(ActivityThread.java:134)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1233)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.os.Looper.loop(Looper.java:137)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.app.ActivityThread.main(ActivityThread.java:4697)
08-08 20:31:35.367: E/AndroidRuntime(605):  at java.lang.reflect.Method.invokeNative(Native Method)
08-08 20:31:35.367: E/AndroidRuntime(605):  at java.lang.reflect.Method.invoke(Method.java:511)
08-08 20:31:35.367: E/AndroidRuntime(605):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
08-08 20:31:35.367: E/AndroidRuntime(605):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
08-08 20:31:35.367: E/AndroidRuntime(605):  at dalvik.system.NativeStart.main(Native Method)
08-08 20:31:35.367: E/AndroidRuntime(605): Caused by: android.database.sqlite.SQLiteException: no such table: users: , while compiling: SELECT  * FROM users
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:68)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:143)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:361)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:127)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:94)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:53)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1671)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1645)
08-08 20:31:35.367: E/AndroidRuntime(605):  at library.DatabaseHandler.getRowCount(DatabaseHandler.java:103)
08-08 20:31:35.367: E/AndroidRuntime(605):  at library.UserFunctions.isUserLoggedIn(UserFunctions.java:71)
08-08 20:31:35.367: E/AndroidRuntime(605):  at com.example.databasetester.DashboardActivity.onCreate(DashboardActivity.java:24)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.app.Activity.performCreate(Activity.java:4539)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
08-08 20:31:35.367: E/AndroidRuntime(605):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2013)
08-08 20:31:35.367: E/AndroidRuntime(605):  ... 11 more

I should also add that there IS a table named "users" in my database. If you guys need me to show some of my code (which I'm sure you will), I'd be more than happy to.

1 Answer 1

0

Here's the error:

08-08 20:31:35.367: E/AndroidRuntime(605): FATAL EXCEPTION: main
08-08 20:31:35.367: E/AndroidRuntime(605): java.lang.RuntimeException: 
  Unable to start activity
  ComponentInfo{com.example.databasetester/com.example.databasetester.DashboardActivity}:
    android.database.sqlite.SQLiteException: no such table: users: , 
  while compiling: SELECT  * FROM users

SUGGESTIONS:

1) Make sure you do have a table "users" (you say you do, but please double-check)

... AND ...

2) Make sure you're specifying the database file correctly:

* SQLite Exception: no such table Error

If you don't specify the database file name correctly I believe it falls back to creating an empty database. This is generally the cause of 'table not found'. Check your path and database file name.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.