CB Lite 2.1 Java Database exists?


#1

Hello
i’m trying to get Couchbase Lite 2.1 to work on my android application, but i’m pretty new in programming and in databases.

How can i check in Java if my Database already exists? And if it exists, how can i get access to this database?

Thanks for your answers


#2

@trantam177,

  You can use API "exists" which can let you know whether database exists or not. Using the API , you can also find the path of the database.

If you would like to access the file of the database. You can use cblite tool.
https://github.com/couchbase/couchbase-lite-core/tree/master/tools . This has all instructions how to use cblite tool which you can query the cblite db file

  You can get the path of DB file  on the console logs when it gets generated in Android studio. You can do adb shell and copy the DB file to your local machine by going to the path  mentioned in console logs.

#3

I think he means programatically. You can check with the Database.exists static method.