0

I have implemented a database-testapp on android using a sqlite, h2 and sybase database. For sqlite I have also implemented the ormlite interface. Now I'm interested if it is possible to use ormlite on android also with h2 or sybase.

HaskellElephant
  • 9,819
  • 4
  • 38
  • 67
lx_audi
  • 3
  • 1

3 Answers3

2

I was skeptical but the answer seems to be yes for H2. I just created a H2 version of the ORMLite HelloAndroid test application which loads and uses H2. It seems to load a lot slower which may be more a function of the size of the application since it has to include the H2 jar than the performance of H2 versus SQLite

You can take a look at the source project here.

http://ormlite.com/docs/android-helloh2

Also, it is important to remember that JDBC is not a sanctioned code path under Android. This seems to work now (with Android 2.1) but there is no guarantee that it will in future versions of Android OS.


I also added a STRING_BYTE database type to ORMLite in version 4.16 so you can store Unicode strings as BLOBs in the database. This allows folks to use SQLite (and other databases which are not Unicode compliant) to store Unicode strings. It will use the Charset.forName("Unicode") by default but you can specify the character set name to store it another way.

Gray
  • 115,027
  • 24
  • 293
  • 354
  • Yes, H2 is slower than SQLite according to my test. Specially for write operations, and because of classloading. I hope I can improve this in the future (I wrote the Android support for H2). – Thomas Mueller Mar 17 '11 at 14:13
  • You also wrote H2. Thanks much for your contributions Thomas. H2 is always my go-to small/test database engine. I've used it all over the place during my development of ORMLite. – Gray Mar 17 '11 at 14:32
1

I didn't test it myself, but I'm almost sure H2 will work. Most likely write operations are slower than SQLite (about half as fast according to my test), some read operations are a bit faster and some are slower.

Sybase Ultralite 12.0.1 does support Android, it looks like there is a closed beta program. Also, there might be a Sybase JDBC driver that can connect to a Sybase database over TCP/IP. I didn't find one so far however.

Thomas Mueller
  • 48,905
  • 14
  • 116
  • 132
0

http://www.sybase.com/detail?id=1002288

SQL Anywhere Ultra Lite runs on android.

According to H2 Database vs SQLite on Android h2 also runs on android.

Community
  • 1
  • 1
kolchanov
  • 2,018
  • 2
  • 14
  • 32