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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:32:53+00:00 2026-06-04T02:32:53+00:00

I am trying to set two databases. After lunch the emulator, and trying to

  • 0

I am trying to set two databases.
After lunch the emulator, and trying to enter data, I have tried to find the exact reason of this error but without success.

I get an error:

05-17 16:23:06.410: E/AndroidRuntime(311): android.database.sqlite.SQLiteException: near “NULLbaby_age_month”: syntax error: CREATE TABLE settings ( _id INTEGER PRIMARY KEY AUTOINCREMENT, uri_baby TEXT NOT NULL, baby_name TEXT NOT NULL, baby_gender TEXT NOT NULL, baby_age_year TEXT NOT NULLbaby_age_month TEXT NOT NULLbaby_age_day TEXT NOT NULL);

The Database Code is:

package com.tamar.efrat;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;

public class DatBas {

public static final String KEY_ROWID = "_id";
public static final String KEY_SHOURS = "start_hour";
public static final String KEY_SMINUTE = "start_minute";
public static final String KEY_SDATE = "start_date";
public static final String KEY_AMOUNT = "amount";
public static final String KEY_SIDE = "side";
public static final String KEY_KIND = "kind";

public static final String KEY_ROW_BABY_ID = "_id";
public static final String KEY_BABY_IMAGE_PATH = "uri_baby";
public static final String KEY_BABY_NAME = "baby_name";
public static final String KEY_BABY_GENDER = "baby_gender";
public static final String KEY_BABY_BORN_DATE_YEAR = "baby_age_year";
public static final String KEY_BABY_BORN_DATE_MONTH = "baby_age_month";
public static final String KEY_BABY_BORN_DATE_DAY = "baby_age_day";

private static final String DATABASE_NAME = "TamatDB";
private static final String DATABASE_TABLE = "stop_watch_records";
private static final String DATABASE_TABLE_SETTINGS = "settings";

private static final int DATABASE_VERSION = 20;

private TamarDatabase thdb;
private static Context tcontext;
private SQLiteDatabase tdb;

private static class TamarDatabase extends SQLiteOpenHelper {

    public TamarDatabase(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String ctData = "CREATE TABLE  " + DATABASE_TABLE + " ( "
                + KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
                + KEY_SHOURS + " TEXT NOT NULL, " + KEY_SMINUTE
                + " TEXT NOT NULL, " + KEY_SDATE + " TEXT NOT NULL, "
                + KEY_AMOUNT + " TEXT NOT NULL, " + KEY_SIDE
                + " TEXT NOT NULL, " + KEY_KIND + " TEXT NOT NULL );";
        db.execSQL(ctData);

        String ctSettings = "CREATE TABLE " + DATABASE_TABLE_SETTINGS
                + " ( " + KEY_ROW_BABY_ID
                + " INTEGER PRIMARY KEY AUTOINCREMENT, "
                + KEY_BABY_IMAGE_PATH + " TEXT NOT NULL, " + KEY_BABY_NAME
                + " TEXT NOT NULL, " + KEY_BABY_GENDER + " TEXT NOT NULL, "
                + KEY_BABY_BORN_DATE_YEAR + " TEXT NOT NULL"
                + KEY_BABY_BORN_DATE_MONTH + " TEXT NOT NULL"
                + KEY_BABY_BORN_DATE_DAY + " TEXT NOT NULL);";
        db.execSQL(ctSettings);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
        db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE_SETTINGS);
        onCreate(db);
    }
}

public DatBas(Context c) {
    tcontext = c;
}

public DatBas open() throws SQLiteException {
    thdb = new TamarDatabase(tcontext);
    tdb = thdb.getWritableDatabase();
    return this;
}

public void close() {
    thdb.close();
}

public long createEntry(String sh, String sm, String sd, String at,
        String tside, String tkind) {
    ContentValues cv = new ContentValues();
    cv.put(KEY_SHOURS, sh);
    cv.put(KEY_SMINUTE, sm);
    cv.put(KEY_SDATE, sd);
    cv.put(KEY_AMOUNT, at);
    cv.put(KEY_SIDE, tside);

    return tdb.insert(DATABASE_TABLE, null, cv);
}

public long createEntrySettings(String bbdy, String bbdm, String bbdd,
        String pt, String bg, String bfName) {
    ContentValues cv2 = new ContentValues();
    cv2.put(KEY_BABY_IMAGE_PATH, pt);
    cv2.put(KEY_BABY_NAME, bfName);
    cv2.put(KEY_BABY_GENDER, bg);
    cv2.put(KEY_BABY_BORN_DATE_YEAR, bbdy);
    cv2.put(KEY_BABY_BORN_DATE_MONTH, bbdm);
    cv2.put(KEY_BABY_BORN_DATE_DAY, bbdd);

    return tdb.insert(DATABASE_TABLE_SETTINGS, null, cv2);
}

public String getData() {
    String[] columns = new String[] { KEY_ROWID, KEY_SHOURS, KEY_SMINUTE,
            KEY_SDATE, KEY_AMOUNT, KEY_SIDE, KEY_KIND };
    Cursor c = tdb.query(DATABASE_TABLE, columns, null, null, null, null,
            null);
    String results = "";

    int iRaw = c.getColumnIndex(KEY_ROWID);
    int iShours = c.getColumnIndex(KEY_SHOURS);
    int iSminute = c.getColumnIndex(KEY_SMINUTE);
    int iDate = c.getColumnIndex(KEY_SDATE);
    int iAmount = c.getColumnIndex(KEY_AMOUNT);
    int iSide = c.getColumnIndex(KEY_SIDE);
    int iKind = c.getColumnIndex(KEY_KIND);

    for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
        results = results + "the id is " + c.getString(iRaw)
                + " the sart hour is " + " " + c.getString(iShours)
                + " the start minute is " + " " + c.getString(iSminute)
                + " the start date is " + " " + c.getString(iDate)
                + " the amount is " + " " + c.getString(iAmount)
                + " the side is " + " " + c.getString(iSide)
                + " the kind is " + " " + c.getString(iKind) + "\n";
    }
    return results;
}

public String getDataSettings() {
    String[] columns = new String[] { KEY_ROW_BABY_ID, KEY_BABY_IMAGE_PATH,
            KEY_BABY_NAME, KEY_BABY_GENDER, KEY_BABY_BORN_DATE_YEAR,
            KEY_BABY_BORN_DATE_MONTH, KEY_BABY_BORN_DATE_DAY };
    Cursor c = tdb.query(DATABASE_TABLE_SETTINGS, columns, null, null,
            null, null, null);
    String results = "";

    int iRawBabyId = c.getColumnIndex(KEY_ROW_BABY_ID);
    int iBIPath = c.getColumnIndex(KEY_BABY_IMAGE_PATH);
    int iBName = c.getColumnIndex(KEY_BABY_NAME);
    int iGender = c.getColumnIndex(KEY_BABY_GENDER);
    int iBBDateYear = c.getColumnIndex(KEY_BABY_BORN_DATE_YEAR);
    int iBBDateMonth = c.getColumnIndex(KEY_BABY_BORN_DATE_MONTH);
    int iBBDateDay = c.getColumnIndex(KEY_BABY_BORN_DATE_DAY);

    for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
        results = results + " the kind is " + " " + c.getString(iRawBabyId)
                + " the kind is " + " " + c.getString(iBIPath)
                + " the kind is " + " " + c.getString(iBName)
                + " the kind is " + " " + c.getString(iGender)
                + " the kind is " + " " + c.getString(iBBDateYear)
                + " the kind is " + " " + c.getString(iBBDateMonth)
                + " the kind is " + " " + c.getString(iBBDateDay) + "\n";
    }
    return results;
}

public DatBas delete() {
    tdb.delete(DATABASE_TABLE, null, null);
    tdb.delete(DATABASE_TABLE_SETTINGS, null, null);
    return null;
}
}
  • 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-04T02:32:55+00:00Added an answer on June 4, 2026 at 2:32 am

    forget to add , in query …

    TEXT NOT NULL,baby_age_month

    AND

    TEXT NOT NULL,baby_age_day

    CREATE TABLE settings ( _id INTEGER PRIMARY KEY AUTOINCREMENT, uri_baby TEXT NOT NULL, baby_name TEXT NOT NULL, baby_gender TEXT NOT NULL, baby_age_year TEXT NOT NULL,baby_age_month TEXT NOT NULL,baby_age_day TEXT NOT NULL);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to set the privileges for two databases at once. I know it
I have a query against two databases that I'm trying to execute. The first
Im trying to copy data only between two SQL server 2008 databases. I need
im trying to set the height of two divs on my page, because my
okay, so I'm trying to set up a webpage with a div wrapping two
I'm trying to merge two arrays for the values of array1 that are set
I'm trying to create two functions: get & set, that both accept an arbitrary
I keep on having these same two problems. I have been trying to use
I have an XML file containing seed data that I'm trying to load into
I have two tables from two different databases. For example: Table: Articles1 - Database:

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.