是否可以在 android 上使用 ormlite 和 h2 或 sybase 数据库?
我已经使用 sqlite、h2 和 sybase 数据库在 android 上实现了数据库测试应用程序。对于 sqlite,我还实现了 ormlite 接口。现在我感兴趣是否可以在 android 上使用 ormlite 以及 h2 或 sybase。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对此表示怀疑,但对于 H2 来说答案似乎是肯定的。我刚刚创建了一个 H2 版本的 ORMLite HelloAndroid 测试应用程序,它加载并使用 H2。它似乎加载速度慢很多,这可能更多地是应用程序大小的函数,因为它必须包含 H2 jar,而不是 H2 与 SQLite 的性能
您可以在此处查看源项目。
此外,请务必记住, JDBC 不是 Android 下认可的代码路径。这似乎现在有效(Android 2.1),但不保证它在未来版本的 Android 操作系统中也有效。
我还在版本 4.16 中向 ORMLite 添加了 STRING_BYTE 数据库类型,以便您可以将 Unicode 字符串作为 BLOB 存储在数据库中。这允许人们使用 SQLite(以及其他不兼容 Unicode 的数据库)来存储 Unicode 字符串。默认情况下,它将使用
Charset.forName("Unicode")
,但您可以指定字符集名称以其他方式存储它。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.
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.我自己没有测试过,但我几乎可以肯定 H2 会起作用。最有可能的是,写入操作比 SQLite 慢(根据我的测试,大约是 SQLite 的一半),有些读取操作稍快一些,有些则较慢。
Sybase Ultralite 12.0.1确实支持Android,看起来有一个封闭的测试版程序。此外,可能还有可以通过 TCP/IP 连接到 Sybase 数据库的 Sybase JDBC 驱动程序。但到目前为止我还没有找到。
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 在 Android 上运行。
根据 H2 数据库与 Android 上的 SQLite
h2 也可以在 Android 上运行。
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.