Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

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.

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top