Export or query data from cblite2 database

I have a device that stores data in a cblite2 structure. It’s a folder, containing a few databases that appear to be on the forestdb file format.

I’m on Ubuntu and I want to export the data from the databases, but the “proper” solution doesn’t seem to be easy to find. I’ve compiled the project on http://github.com/couchbase/couchbase-lite-core.git and tried the cblite tool from there. Unfortunately, that appears to require the DB to use the sqlite3 storage engine, while my DBs appear to use a forestdb storage engine. My dbname.cblite2 folders have a db.forest.0 (or db.forest.1) file, rather than db,sqlite3.

What should I do at this point? Any suggestions to be able to access the data? I’ve tried compiling the forestdb project and using forestdb_dump utility, but the best-case result I’ve seen so far is some binary data with some json text embedded. So it’s possible to read, but this would require a really hackish solution to use the data for further processing.

Before I found the forum, I asked on github. I got a response there, saying I should use CBL 1.x to convert the DB to sqlite first.

Could anyone give me some pointers? Is “couchbase-lite-core” the correct project to be looking at? It seems forestdb was removed from there before it reached release status, and older commits don’t compile.

If you are unaware of CBL 1.x, then how did you get a forestdb database in the first place?

I copied it from a device I have that stores some info in couchbase. It’s an OpenROV Trident, and the telemetry data (roll, pitch, yaw, depth, temperature, pressure, etc) is stored in this DB.

That device probably used a CBL 1.x based application. Are you not associated with that project? Can you track down the person who is? That would be your best bet for fast information. ForestDB has been deprecated and is no longer in use as of Couchbase Lite 2.0 (which LiteCore was made for).

The sanest way forward is to build a small CBL 1.x based application (more info on Couchbase Lite here). How to get it will depend on the platform you are developing for but after you set up an application (it can be a desktop application to if you use Java or .NET) you can make two databases: One using the ForestDB engine and one using the SQLite engine. The former should import the database you have. After that the steps are

  1. Create an all documents query on the ForestDB database
  2. Loop through them all and create a document in the SQLite database using the properties you got
  3. Save each document

After that you will have a SQLite backed database with the same data.

Isn’t there a legacy application I can use on Ubuntu Linux (Java, C, python, …) that can read my database and dump or query the information? A command line application I could integrate into a script somehow would be perfect. If I could fetch the right project from GitHub, check out an old tag or branch and build that, I’d be all set. I’ve tried quite a few already projects, but haven’t struck gold yet.

The data is from an OpenROV Trident, an underwater drone. I’ve been in touch with them, but i think they are pretty busy fulfilling pre-orders and developing their software. I figured it’d be pretty easy to access the data in an open source database so I could use it in ways they haven’t planned yet.

I feel the need to set some context here, with this screenshot from the front page of the couchbase website. :wink: OpenROV chose couchbase, I’m their customer. My user experience at this point isn’t very good. Is my intended use so unexpected?

Can anyone recommend which project to fetch from GitHub to gain sensible access to my data? Is there a tag or a branch of the code that might work with what I have?

Any pointers would be much appreciated!

OpenROV chose couchbase, I’m their customer. My user experience at this point isn’t very good.

You’re trying to reverse-engineer their application’s file format (which happens to be based on Couchbase Lite), without support from the developer. In my experience that’s generally not easy, and generally not something developers will help you with. (For instance, even if a developer uses SQLite, you can read the raw data easily but that doesn’t help you figure out the specific table schema they’re using.)

Part of the confusion here, I think, is that you saw the filename suffix .cblite2 and assumed this was created by Couchbase Lite 2. It wasn’t. The 2 in the filename just means it’s the second major version of the file format; it’s used by all shipping versions of Couchbase Lite.

You should be able to open and read the database by using Couchbase Lite 1.4 and enabling the ForestDB storage engine.

Thanks. Could you perhaps point me at the source code for Couchbase Lite 1.4 so I can compile it and enable to ForestDB storage engine?

What I’ve tried so far:

https://github.com/couchbase/couchbase-lite-core.git has no tag or branch that seems to indicate a version 1.4.

I’ve cloned the couchbase-lite-java repo and then I checked out branch release/1.4.1, but the src/main/java/com/couchbase/lite/storage folder only contains the files JavaSQLiteStorageEngineFactory.java and JavaSQLiteStorageEngine.java. So no ForestDB support?

Could you please point me in the right direction? What project should I be looking at, and how do I enable ForestDB when I have the code?

Thanks, but I specifically want to work with this data on another platform, and not my Android device. I use Ubuntu Linux on my computer. Does couchbase-lite-android work on Ubuntu?

I believe the repo you want then is couchbase-lite-java-core but I’m not certain.