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

  • Home
  • SEARCH
  • 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 6382795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:34:08+00:00 2026-05-25T02:34:08+00:00

If we already have a database file in .sql format, how can we load

  • 0

If we already have a database file in .sql format, how can we load this in our android app & use its data?

I also had this same problem and I did what jaydeep said. But I m not able to proceed..Please help me. I added 1 method in this to retrieve 1 record which is as follows:

public Cursor getTitle(String g,String k) throws SQLException { 
    Cursor c = myDataBase.rawQuery(
      "select * from titles where food LIKE '%"+g+"%' and area LIKE '%"+k+"%' ",
    null); 
    if (c != null) {
        c.moveToFirst(); 
    }
    return c;
}

where titles is id name of table in database n food area n rest are fields. and in main file i did as follows:

{
    Datahelper myDbHelper = new Datahelper(this); 
    final String tem="Chinese"; 
    final String tem2="Bur Dubai"; 

    final ListView list = (ListView)findViewById(R.id.list);

    try {
        myDbHelper.createDataBase();
    } catch (IOException ioe) {
        throw new Error("Unable to create database");
    }

    try {
        myDbHelper.openDataBase();
    }catch(SQLException sqle){
        throw sqle;
    }
    Cursor c = myDbHelper.getTitle(tem,tem2);

    if (c.moveToFirst()) DisplayTitle(c);
    else Toast.makeText(this, "No title found", 
      Toast.LENGTH_LONG).show();
}

public void DisplayTitle(Cursor c) {
    final TextView ter=(TextView)findViewById(R.id.ter); 
    c.moveToPosition(0);
    while (c.isAfterLast() == false) {
        ter.append(c.getString(3)+"\n");
        c.moveToNext();
    }
    c.close();
}

Please help me.

ListView code:

if (c.moveToFirst()) 
{ 
final String [] restarr=c.getColumnNames(); 

String[] fields = new String[] {db.KEY_REST}; 

list.setAdapter(new ArrayAdapter<String>(this, R.layout.main, restarr)); 

SimpleCursorAdapter rest = new SimpleCursorAdapter(this,android.R.layout.simple_list_item_1,c,fields, new int[] {android.R.id.text1}); 

list.setAdapter(rest); 
}
  • 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-25T02:34:09+00:00Added an answer on May 25, 2026 at 2:34 am

    You need SQLite version of the database. I bet your current database you want to ship to the application, has schema written with pure SQL syntax which quite different from SQLite.

    If my assumption is true, then you need to extract the schema and convert it to SQLite. This takes some minor changes in the syntax but logic stays the same.

    Here is nice tutorial how you can ship your external local database in your android application:

    http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

    Mind the version and extension of the database file.

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

Sidebar

Related Questions

If we already have a databse file in .sql format, How can we load
A have an app with that uses an SQL database. The application is already
I have a .sql file and I want to load it into MySQL database.
I have a database table using an enum. This is already working with hibernate
I already have a deploy.rb that can deploy my app on my production server.
I have a large database dump.sql file I am importing from the command line
We have a database called AVL in SQL Server 2008 R2 SE. This database
I already have Java code to display and process data from a database. I
I want to check my database for records that I already have recorded before
We already have things like static analysis that tells us what's wrong with our

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.