便携式JDBC VS SQLite的Andr​​oid上VS、JDBC、SQLite、oid

2023-09-05 02:10:56 作者:身边浊物极多

我使用SQLite在使用Android应用程序的项目。目前我使用的 android.database.sqlite 提供的SQLite的执行情况。

I am using SQLite in a project used by an android application. Currently I am using the SQLite implementation provided in android.database.sqlite.

我想让它使用相同的codeBase的桌面应用程序。所以,我需要单独所有共享的行为放到一个单独的便携式项目/瓶。

I want to make a desktop application which uses the same codebase. So I need to separate all the shared behaviour into a separate portable project/jar.

我的问题是我目前大量使用的 android.database.sqlite 。如果可能的话,我不想重新写每一个数据库访问调用与JDBC兼容或什么我都会有不使用所提供的SQLite在Android中使用。

My problem is I'm currently making heavy use of android.database.sqlite. If possible I do not want to re-write every database access call to be compatible with JDBC or whatever I will have to use without using the android provided SQLite.

要解决这一问题,在现有的code的影响微乎其微。我打算写一个SQLite接口,共享code将使用......在Android将会由平凡 android.database.sqlite ,它会通过某种方式残害的SQLite通过JDBC来匹配来实现桌面上的 android.database.sqlite

To solve this problem with minimal impact on the existing code. I intent to write a SQLite interface (compatible with android.database.sqlite) which the shared code will use... on android it will be implemented trivially by android.database.sqlite, and on the desktop it will be implemented by somehow mutilating SQLite through JDBC to match android.database.sqlite.

这被证明是困难的,因为我经常供给对象[] 阵列绑定到prepared这JDBC要求严格类型声明,我不熟悉的JDBC在所有。

This is proving difficult as I often supply Object[] arrays to be bound to prepared statements which JDBC requires strict typing, and I am not familiar with JDBC at all.

有可能拯救我的努力任何其他方式使用SQLite在Java中,它类似于 android.database.sqlite ,或任何其他方法(和必然的调试)伴有重写许多数据库的接入点?

Is there any other way to use SQLite in Java which is similar to android.database.sqlite, or any other approaches which may save me the effort (and inevitable debugging) associated with re-writing many database access points?

Disclamer:我从来没有到现在为止使用JDBC试图

简体问题:什么是使用SQLite在Java中的最佳方式是什么? JDBC,其他的?

推荐答案

我想创建一个包装将是一个不错的主意,但可能会在发展方面以及测试涉及了很多的努力。也许你可以开始对谷歌的项目,并得到一些更多的人参与进来。

I think creating a wrapper would be a good idea, but may involve a lot of effort in terms of development as well as testing. Maybe you can start a project on google and get a few more people involved.

在一个侧面说明,我相信有已经在谷歌code这样一个项目叫的 sqldroid

On a side note, I believe there's already such a project on google code called sqldroid