• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Your thoughts on best way to manage a multiple DB App

Guitarist

Newbie
Oct 17, 2011
13
2
I could use some thoughts/suggestions on "what may be the best approach to handing multiple SQLite DBs for an Android app based upon a template DB?"

About the existing app - representing the issue of handling multiple DBs in Android:
As brief as possible, I have an existing Java-based Research DB app that allows a user to create a subject oriented database for research that requires the user to document a source for each note on a subject. A subject would be a single database. (blank.zip attached contains SQLite db examples)

So there is a blank template database (i.e. blank.db) that is copied and renamed to the subject the user chooses to research. The SQLite template database contains 11 tables, 10 relation-ally linked to a Notes table. The remaining 10 tables are Sources, Authors, Author_by_Source, Comments, Quotes, Terms, Topics, Files, File_by_Note, Questions.
However, a user can delete, export, or import any database they wish except the blank.db and sample.db which come with the app.

What have I done:
I've have been reading and doing hands-on tutorials learning the Android C.R.U.D approach through the DatabaseHelper. I've also learned about the Asset folder and storing databases already created within a sub folder called databases. So this where I ask my question(s).

So the Discussion Questions:
What is the best way to handle creating new databases?

Can I manage everything through the Assets folder?
 

Attachments

  • blank.zip
    150.5 KB · Views: 324
It's your lucky day. I know the perfect architectural pattern to handle multiple data sources. And it even follows a recipe for you to cut and paste code straight into your app.
Forget using SQLiteHelper classes. Use Room, an object/database mapping library.

https://codelabs.developers.google.com/codelabs/android-room-with-a-view/

This architecture involves using a 'repository', which is a data layer that can handle multiple data sources. It also includes a pattern for observing live data, so your UI layer can automatically show the most up to date view of the data.
 
  • Like
Reactions: Unforgiven
Upvote 0
I ll love to give my thoughts on this, establishing connections to multiple databases is not a trivial task because each database product implements its own connection parameters. For instance, some databases require a default database, whereas others do not. Navicat smooths out these differences by providing a consistent Connection dialog for each database type, with only a few minor variations between screens.
 
  • Like
Reactions: Sam billings
Upvote 0
I ll love to give my thoughts on this, establishing connections to multiple databases is not a trivial task because each database product implements its own connection parameters. For instance, some databases require a default database, whereas others do not. Navicat smooths out these differences by providing a consistent Connection dialog for each database type, with only a few minor variations between screens.

Hi Julia!

Thanks for sharing your thoughts and I will read up on Navicat. In the app currently operating, opening and closing multiple databases, and cleanly was difficult.
 
Upvote 0
I was also researching about this topic & ll love to add more, the DBA’s role is becoming increasingly complex and now often involves managing data both on premise and in the cloud, and in a variety of database management systems including not only traditional relational systems such as Oracle, SQL Server, MySQL and others, but also new open source and NoSQL technologies. It may sound crazy at first, since most of the Rails applications we tend to work with connect to just one database. But, it actually isn't that unusual to have a single app communicate with more than one database. I will sure go through on Navicat & other sources suggested by Julia & other members.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones