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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:48:01+00:00 2026-06-05T19:48:01+00:00

this is my code to create database table String sqlQueryToCreateFileTable = create table if

  • 0

this is my code to create database table

String sqlQueryToCreateFileTable = "create table if not exists " + TABLE_FILE + " ( " + BaseColumns._ID + " integer primary key autoincrement, " 
+ COLUMN_NAME_FILE_NAME + " text not null, "
+ COLUMN_NAME_FILE_CATEGORY+ " integer not null , FOREIGN KEY ("+COLUMN_NAME_FILE_CATEGORY+") REFERENCES "+TABLE_CATEGORY+" ("+BaseColumns._ID+"), " 
+ COLLUMN_NAME_FILE_THEME+ " integer not null , FOREIGN KEY ("+COLLUMN_NAME_FILE_THEME+") REFERENCES "+TABLE_THEME+" ("+BaseColumns._ID+"), " 
+ COLLUMN_NAME_FILE_DATE_CREATING+ " integer not null , FOREIGN KEY ("+COLLUMN_NAME_FILE_DATE_CREATING +") REFERENCES "+TABLE_DATE+" ("+BaseColumns._ID+"), " 
+ COLLUMN_NAME_FILE_CLOUD + " text default null,"
+ COLLUMN_NAME_FILE_DATE_UPLOADING + " text default null);";

db.execSQL(sqlQueryToCreateFileTable);

but I have that in the logcat

06-15 18:24:09.177: I/Process(9075): Sending signal. PID: 9075 SIG: 9
06-15 18:31:01.428: I/Database(10559): sqlite returned: error code = 1, msg = near "file_theme_column": syntax error
06-15 18:31:01.428: E/Database(10559): Failure 1 (near "file_theme_column": syntax error) on 0x5882f8 when preparing 'create table if not exists file_table ( _id integer primary key autoincrement, file_name_column text not null, file_category_column integer not null , FOREIGN KEY (file_category_column) REFERENCES category_table (_id), file_theme_column integer not null , FOREIGN KEY (file_theme_column) REFERENCES theme_table (_id), file_date_creating_column integer not null , FOREIGN KEY (file_date_creating_column) REFERENCES date_table (_id), file_cloud_column text default null,file_date_upload_column text default null);'.
06-15 18:31:01.468: D/AndroidRuntime(10559): Shutting down VM
06-15 18:31:01.468: W/dalvikvm(10559): threadid=1: thread exiting with uncaught exception (group=0x40015560)
06-15 18:31:01.488: E/AndroidRuntime(10559): FATAL EXCEPTION: main
06-15 18:31:01.488: E/AndroidRuntime(10559): android.database.sqlite.SQLiteException: near "file_theme_column": syntax error: create table if not exists file_table ( _id integer primary key autoincrement, file_name_column text not null, file_category_column integer not null , FOREIGN KEY (file_category_column) REFERENCES category_table (_id), file_theme_column integer not null , FOREIGN KEY (file_theme_column) REFERENCES theme_table (_id), file_date_creating_column integer not null , FOREIGN KEY (file_date_creating_column) REFERENCES date_table (_id), file_cloud_column text default null,file_date_upload_column text default null);
06-15 18:31:01.488: E/AndroidRuntime(10559):    at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
06-15 18:31:01.488: E/AndroidRuntime(10559):    at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1763)
06-15 18:31:01.488: E/AndroidRuntime(10559):    at com.app.pfe.AndroidOpenDbHelper.onCreate(AndroidOpenDbHelper.java:95)
06-15 18:31:01.488: E/AndroidRuntime(10559):    at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:126)
 how can I fix this error?
  • 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-05T19:48:04+00:00Added an answer on June 5, 2026 at 7:48 pm

    Like pawelzieba said, you should try reformatting to

    create table if not exists file_table ( 
        _id integer primary key autoincrement, 
        file_name_column text not null, 
        file_category_column integer not null, 
        file_theme_column integer not null, 
        file_date_creating_column integer not null, 
        file_cloud_column text default null,
        file_date_upload_column text default null,
        FOREIGN KEY (file_category_column) REFERENCES category_table (_id), 
        FOREIGN KEY (file_theme_column) REFERENCES theme_table (_id), 
        FOREIGN KEY (file_date_creating_column) REFERENCES date_table (_id)
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With this code: var db = google.gears.factory.create('beta.database'); db.open('cominar'); db.execute('CREATE TABLE IF NOT EXISTS Ajax
Can anyone alter this code to include one integer variable. Not including the database
Im create this code to store page view in database, but i have problem
I have this code to create a database: from sqlalchemy import create_engine from sqlalchemy
I found out how to find if the database exists with this code: if(mysql_select_db('db-name'))
I am not able to create database columns when i use t.string or t.number.
I have this code in my DataBase Helper: public ArrayList<ArrayList<Object>> getAllRowsAsArrays() { // create
I have made this code to open a database(created in SQLite browser) stored in
Why, this code create 2 the same columns in grid (Color and Color). How
I have this code to create an ATOM feed Dim xmlResult As New StringBuilder

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.