0

It is possible to pre-populate an Android Room database, as per this:

Room.databaseBuilder(appContext, AppDatabase.class, "Sample.db")
    .createFromAsset("database/myapp.db")
    .build();

However, all code on the internet uses a .db file from the assets folder.

I use MySQL on my system. Is it somehow possible to export a database from MySQL in .db format and directly load from that in Android Room? It seems that exporting the schema from MySQL Workbench creates something that is not the same as a .db file.

Wrichik Basu
  • 1,005
  • 17
  • 28
  • db file is an sqlite binary database file format, mysql workbench cannot export it in such format. However, you may fare better if you sync the two, rather than trying to download a new db file from the server. – Shadow Oct 06 '22 at 17:28

0 Answers0