-1

I read about SQLite. I found information about making database in Android but I am wondering about opening existing database written somewhere else. Is there a possibility to open and read database from .sql file which I prepared earlier?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Halep
  • 93
  • 1
  • 1
  • 12

3 Answers3

1

I guess you could use SQLiteDatabase db = SQLiteDatabase.openDatabase(pathToYourDatabase, null, SQLiteDatabase.OPEN_READWRITE));

Otherwise you would probably need to open/read the .sql file and use it to create the database + data.

1

Perhaps SQLiteDatabase.openOrCreateDatabase(dbfile, null); is what you want .But only .db file works.

xiaoyuan
  • 423
  • 4
  • 13
0

Yes, You can open and read from the existing database file if your app has access to the .DB file. If the .DB file is in another app memory, you will not be able to access it. But if the .DB file is on external storage you can open and read from it.

AbhishekB
  • 2,111
  • 3
  • 18
  • 23