Berkeley DB Java Edition and Android

I've recently done some work to get JE running under Android.  This platform is significantly different from J2SE in several ways, but it is still close enough to a "real" J2SE that JE can run on it.  For instance, the Android heap size is fixed at 16MB (vs. 64MB on a Sun J2SE JVM).  JE runs fine on a 16MB heap, but many of our defaults assume more space.  So rather than make all Android users tweak several parameters down , we do it for them when we detect the Android JVM ("Dalvik").  Additionally, I encountered some bugs in the JVM that now have workarounds built into the JE code.  For example, the Dalvik Adler32 checksum code returns different values depending on whether you checksum an array a byte at a time or all at once.

The JE DPL will not work under Android at present because full runtime support for Java 5 Annotations is not implemented yet by the Dalvik runtime library (I think it may be the Apache Harmony RT).  If we find that there is demand for DPL on Android we will implement an alternative to the annotation-based schema specification.

I ran some of our internal stress tests and JE seemed to hold up well.  I am pretty sure that the long-running, heavy-IO style of test that I ran is not representative of what typical JE applications on Android.  I didn't run any performance tests because it seemed pointless to benchmark an emulator.

The currently available "production" release of JE -- JE 3.2.x -- will not work on Android without some tweaks.  But rather than force users to wait for JE 3.3.x (scheduled to be released "later"), we have decided to make a "Beta" version of 3.3.x available on our download site.  Several things should be noted about this release:

  • It is not supported.  You may report bugs with it on the JE OTN forum but we may not fix them.
  • You should not deploy any application with this release.  It is Beta.
  • This release is backward compatible with 3.2.x releases, so you can use it with existing JE 3.2.x environments.  However, once 3.3.x touches those environments, they can never go back to 3.2.x.  Nor can they go forward to a newer 3.3.x.  Hence, you probably don't want to use 3.3.x with an existing environment.
  • This release will not be forward compatible with future 3.3.x releases.
  • Future 3.3.x releases will not be backward compatible with this release.
  • Any environments and databases that you create with this release must necessarily be deleted before using a later 3.3.x release.
When you download the release, there is a HOWTO-Android.html file in the docs/ directory.  This is linked to from both the release notes and the changelog.  This HOWTO gives a recipe for creating a small Android application which will allow you to enter key/data pairs into a TextEdit box, write them to a JE database, and then read them back again.  Its a stunningly simple little application, but the idea is just to get you started with JE on Android.  There are a few little hoops that you have to jump through (e.g. you have to create stubs for three javax.transaction.xa.*.java files since JE requires them in order to compile), but it's all described in the document and it's not hard.

I apologize in advance for the registration that is required to download the 3.3.x beta release.

We'd like to hear your feedback on using JE with Android.  You can either post comments to the JE OTN forum, or send me email (charles.lamb).

Comments:

Hi, Does Berkeley DB XML support Andriod??

Posted by piaoyi on July 29, 2008 at 11:21 AM EDT #

No, unfortunately, it doesn't. DB XML sits on top of Berkeley DB "Core" (the C edition) and that has not been ported to Android. -cwl

Posted by Charles Lamb on July 29, 2008 at 11:28 AM EDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Anything related to Oracle NoSQL Database and/or Berkeley DB Java Edition.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today