Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8161477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:30:29+00:00 2026-06-06T18:30:29+00:00

I was stuck in the middle of no such table error while I created

  • 0

I was stuck in the middle of no such table error while I created a database class. The logcat said that no such table. I have been trying to solve with several ways and unfortunately still got an error. Followings are the codes and Error is

android.database.sqlite.SQLiteException: no such table: tbl_category: , while compiling: SELECT * FROM tbl_category WHERE idx = 1

public class DatabaseManager extends SQLiteOpenHelper {
private SQLiteDatabase db;
private static Context myContext;
public static final String DB_NAME = "ykko.db";

public static final String name = "name";
public static String DB_PATH = "/data/data/com.bit.ykko/databases/";

public DatabaseManager(Context context) {
    super(context, DB_NAME, null, 1);
    DatabaseManager.myContext = context;
}

public void createDataBase() throws IOException {
    boolean dbExit = checkDataBase();

    if (dbExit) {

    } else {
        this.getReadableDatabase().getPath();

        try {

            copyDataBase();

        } catch (IOException e) {
            // throw new RuntimeException(e.getMessage());
            e.printStackTrace();
        }
    }
}

private boolean checkDataBase() {
    SQLiteDatabase checkDb = null;

    try {
        String myPath = DB_PATH + DB_NAME;
        Log.v("Path", myPath);
        checkDb = SQLiteDatabase.openDatabase(myPath, null,
                SQLiteDatabase.OPEN_READONLY);
    } catch (SQLException e) {

    }

    if (checkDb != null) {
        checkDb.close();
    }
    return checkDb != null ? true : false;
}

public void copyDataBase() throws IOException {

    InputStream databaseInput = null;
    String outFileName = DB_PATH + DB_NAME;
    OutputStream databaseOutput = new FileOutputStream(outFileName);

    byte[] buffer = new byte[1024];
    int length;

    databaseInput = myContext.getAssets().open("ykko.sqlite");
    while ((length = databaseInput.read(buffer)) > 0) {
        databaseOutput.write(buffer, 0, length);
        databaseOutput.flush();
    }
    databaseInput.close();

    databaseOutput.flush();
    databaseOutput.close();
}

public void openDatabase() throws SQLiteException {

    String myPath = DB_PATH + DB_NAME;
    db = SQLiteDatabase.openDatabase(myPath, null,
            SQLiteDatabase.OPEN_READWRITE);

}

public ArrayList<ChineseInfo> getCatByIdx(int idx) {
    ArrayList<ChineseInfo> list = new ArrayList<ChineseInfo>();

    String query = "SELECT * FROM tbl_category WHERE idx = " + idx;

    Cursor c = this.db.rawQuery(query, null);

    if (c.moveToFirst()) {
        do {
            ChineseInfo ch = new ChineseInfo();
            ch.idx = c.getInt(0);
            ch.name = c.getString(1);
            ch.mm_name = c.getString(2);
            list.add(ch);

        } while (c.moveToNext());
    }
    if (c != null && !c.isClosed()) {
        c.close();
    }
    return list;
}

@Override
public void onCreate(SQLiteDatabase db) {
    // TODO Auto-generated method stub

}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // TODO Auto-generated method stub

}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:30:30+00:00Added an answer on June 6, 2026 at 6:30 pm

    This issue has been fixed by myself. The error only happening in emulators.It is work fine at real devices.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an unusual problem that caused my mind to stuck. I have created
I have been all over this one, and I am just plumb stuck. I
I understand this is a basic question... but I have been stuck on it
https://i.stack.imgur.com/bhrYD.png here is a screenshot I am trying to style it such that the
Actually I am stuck in middle of some mysql code. Can anyone suggest a
Been stuck on this for ages. Currently learning Django and done some bits on
Kinda stuck here... I have an application with lets say 5000 rows of data
im stuck with a problem im basically trying to create a function where I
I have a Lucene index that has several documents in it. Each document has
Windows Phone 7.5 app. Designer has created Home.xaml in Blend that has 3 images(menu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.