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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:51:11+00:00 2026-05-28T14:51:11+00:00

I’m attempting to create a SQLite db and populate it with data initially. When

  • 0

I’m attempting to create a SQLite db and populate it with data initially. When I run the program through the debugger in Eclipse, nothing appears on the screen but I get the following from LogCat:

sqlite returned: error code = 1, msg = no such table: Issues

Here’s some of the code (I’ll try to show only what’s needed but if you need to see more, plz let me know):

MainActivity.java

public class MainActivity extends Activity {

//TAG for LogCat.
public static final String TAG = "SQLiteDebug";
private ListView mListViewIssues;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    //Load listview control.
    mListViewIssues = (ListView)findViewById(R.id.listIssues);

    //Create Data Creator.
    IssueInfoCreator creator = new IssueInfoCreator(this);

    creator.open();
    try {
        creator.insertRandomData();
    } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    //add data to listview through adapter.
    mListViewIssues.setAdapter(new IssueInfoAdapter(this, creator.queryAll()));

    //Close connection.
    creator.close();
}
}

Code for IssueInfoCreator:

public class IssueInfoCreator {

//DB Adapter.
private DBAdapter mDBAdapter;

//Constructor.
public IssueInfoCreator(Context c){
    mDBAdapter = new DBAdapter(c);
}

//Open DBAdapter.
public void open(){
    mDBAdapter.open();
}

//Insert Random Data to get started.
public void insertRandomData() throws ParseException{
    long i = 999;
    Date dtDate = new Date();
    dtDate.parse("1/12/2012");

    mDBAdapter.insertIssue(i++, dtDate, "This is my ticket.  I'm having trouble starting my sim.");
    mDBAdapter.insertIssue(i++, dtDate, "I can't my sim to turn on, please help.");
    mDBAdapter.insertIssue(i++, dtDate, "Aircraft is not responding to callsign.");
    mDBAdapter.insertIssue(i++, dtDate, "TTS is not recognising when we attempt to land an aircraft.");
}

//Get all Issues from DB.
public List<IssueInfo> queryAll(){
    return mDBAdapter.fetchAllIssues();
}

//close connection.
public void close(){
    mDBAdapter.close();
}
}

Code for DBAdapter:

public class DBAdapter {

//Database fields.
public static final String ISSUES_TABLE = "Issues";
public static final String COL_ISSUE_ID = "_id";
public static final String COL_DATE_RECEIVED = "DateReceived";
public static final String COL_ISSUE_SUMMARY = "IssueSummary";

//Declarations.
private Context mContext;
private SQLiteDatabase mDB;
private DBHelper mDBHelper;

//Constructor.
public DBAdapter(Context c){
    mContext = c;
}

//Open DB Connection.
public DBAdapter open() throws SQLException{
    mDBHelper = new DBHelper(mContext);
    mDB = mDBHelper.getWritableDatabase();
    return this;
}

//Close DB Connection.
public void close(){
    mDBHelper.close();
}
//remaining code omitted for brevity...
}

and finally code for DBHelper:

public class DBHelper extends SQLiteOpenHelper {

//Constants
private static final String DB_NAME = "dbOpenIssues";
private static final int DB_VERSION = 1;
private static final String CREATE_DB_SQL = 
        "CREATE TABLE Issues ( " +
                "_id int PRIMARY KEY, " +
                "DateReceived datetime NOT NULL, " +
                "IssueSummary text NOT NULL " +
                ");";
private static final String DROP_TABLE = 
        "DROP TABLE IF EXISTS Issues";

public DBHelper(Context context) {
    super(context, DB_NAME, null, DB_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {
    db.execSQL(CREATE_DB_SQL);
}

@Override   
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL(DROP_TABLE);
    onCreate(db);
}
}

If I run it with an emulator attached, I can see that the DB gets created in the file explorer but if I pull it down locally and open it with SQLiteMan, it only shows the android_metadata table.

Any ideas? again, sorry for the long post, just didn’t want to leave anything out and have to repost 10 different times.

UPDATE:

One thing I tried was to print the SQL statement in LogCat but I noticed the onCreate (in DBHelper)never gets called:

public void onCreate(SQLiteDatabase db){
    Log.e("DB ERROR -- ", CREATE_DB_SQL);
    db.execSQL(CREATE_DB_SQL);
}
  • 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-05-28T14:51:12+00:00Added an answer on May 28, 2026 at 2:51 pm

    There is no datetime type in SQLite. To store data you can use TEXT. So in your case query can be the following:

    private static final String CREATE_DB_SQL = 
            "CREATE TABLE Issues (" +
                    "_id integer PRIMARY KEY, " +
                    "DateReceived text NOT NULL, " +
                    "IssueSummary text NOT NULL)";
    

    Here is the link to data types.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to construct a data frame in an Rcpp function, but when I
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.