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 8285167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:23:55+00:00 2026-06-08T11:23:55+00:00

i creating the database but when i run the application the database is not

  • 0

i creating the database but when i run the application the database is not creating and there is no error in catlog please help me.
and in the fileexplorer/data/data there is not creating the folder name database
and also when i print something in MySQLiteHelper to console Class nothing print on the console.
please help me thanks in advance.

public class MySQLiteHelper extends SQLiteOpenHelper {

public static final String TABLE_NAME_BOY = "question_boy";
public static final String ID_BOY = "_id";
public static final String QUESTION_BOY = "questions";
public static final String ANSWER_BOY = "answer";

public static final String TABLE_NAME_GIRL = "questions_girl";
public static final String ID_GIRL = "_id";
public static final String QUESTION_GIRL = "questions";
public static final String ANSWER_GIRL = "answer";

private static final String DATABASE_NAME = "bg.database";
private static final int DATABASE_VERSION = 3;

private static final String CREATE_TABLE_BOY = "create table "
        + TABLE_NAME_BOY + "(" + ID_BOY
        + "integer primary key autoincrement, " + QUESTION_BOY + " text, "
        + ANSWER_BOY + " text);";

private static final String CREATE_TABLE_GIRL = "create table "
        + TABLE_NAME_GIRL + "(" + ID_GIRL
        + "integer primary key autoincrement, " + QUESTION_GIRL + " text, "
        + ANSWER_GIRL + " text);";

public MySQLiteHelper(Context context, String name,
        CursorFactory factory, int version) {
    super(context, DATABASE_NAME, null, DATABASE_VERSION);
    // TODO Auto-generated constructor stub
}

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

    db.execSQL(CREATE_TABLE_BOY);
    db.execSQL(CREATE_TABLE_GIRL);

}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // TODO Auto-generated method stub
    Log.w(MySQLiteHelper.class.getName(),

            "Upgrading database from version " + oldVersion + " to "

                        + newVersion + ", which will destroy all old data");

db.execSQL("DROP TABLE IF EXISTS" + TABLE_NAME_BOY);
db.execSQL("DROP TABLE IF EXISTS" + TABLE_NAME_GIRL);

onCreate(db);
}

}

  • 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-08T11:23:57+00:00Added an answer on June 8, 2026 at 11:23 am

    This should create a database for u……

    public class DBHandler extends SQLiteOpenHelper {
    
        private SQLiteDatabase sqliteDatabaseInstance_ = null;
    
        public DBHandler(Context context){
    
            super(context, "TESTDATABASE.db", null, 1);
            sqliteDatabaseInstance_ = getWritableDatabase();
            sqliteDatabaseInstance_.execSQL("PRAGMA foreign_keys = ON;");
        }
    
    @Override
        public void onCreate(SQLiteDatabase db) {
    
            try {
    
                db.execSQL("CREATE TABLE ACCOUNT (accountId INTEGER PRIMARY KEY, name TEXT)");
    
                db.execSQL("CREATE TABLE ORDER_DETAILS (orderNo INTEGER, accountId INTEGER," +
                        "FOREIGN KEY (accountId) REFERENCES ACCOUNT(accountId))");
            }catch (SQLiteConstraintException sqliteConstraintException) {
    
                System.out.println("sqliteConstraintException: " + sqliteConstraintException.getMessage());
            }catch (Exception e) {
    
                System.out.println("Exception in DBHandler.onCreate: "+e.getMessage());
            }
        }
    
        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {}
    
    }
    

    ur db file should be under………

    Go to file explorer —–> data ——> data ——> com.test —–> TESTDATA.db

    HOPE THIS HELPS.

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

Sidebar

Related Questions

Quite embarrassing really, but I tested creating a database from a spreadsheet with a
When creating database tables I'm often stumped when trying to name my time/date/timestamp fields.
I am programmatically creating a database connection object inside a simple procedure (not a
I'm creating a database application using ASP.NET and I want to make a Windows
I am creating an application to help our team manage a twitter competition. So
I have an Oracle 9 database from which my Delphi 2006 application reads data
I know this is a low-level question but, not being a database person, I
I'm creating a GUI application which interacts with database so I need fixture management
I have an ETL application which extracts data from a source database (for which
I am creating database Entities in my Java application and trying to rationalize between

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.