Subject Re: [Firebird-Java] Re: JayBird + Firebird on Android
Author mariuz
On Wed, Nov 30, 2011 at 11:54:22AM +0100, Mark Rotteveel wrote:
> On Wed, 30 Nov 2011 12:16:22 +0200, mariuz <mariuz@...-dev.ro>
> wrote:
> >> Looking at
> >> http://stackoverflow.com/questions/1728476/does-android-support-jdbc
> and
> >> remembering the error you received, I suspect getting Jaybird to work
> on
> >> Android would require quite some work rewriting the driver to work. I
> >> think
> >> you will probably be better off (and more scalable) to create a
> >> webservice
> >> near the database and having the android application access that
> >> webservice
> >> instead of accessing the database directly.
> >>
> >> It will probably also be more performant and more secure (the
> 'insecure'
> >> mobile phone can only perform those actions that the webservice
> exposes),
> >> and will probably improve the technical design of the application.
> >
> > I have seen that some apps sqlite put their own jdbc classes and the
> > driver inside
> > (I saw some in the android git sources and i will dig deeper)
> > 1. put all jdbc related classes even the ones google will not support in
> > the future (just to be safe)
> > 2. add the jdbc firebird pure driver
> > 3. also put what firebird driver related classes that are not yet
> included
> > in android sdk
> >
> >
> > I have seen this app pgtop
> >
> http://www.slideshare.net/markwkm/pgtop-for-android-things-i-learned-making-this-app
> > https://github.com/markwkm/PGTop
> >
> > so it seems that is loading the pg jdbc jar
> > so it is possible to do the same with firebird jdbc one
> >
> > All we need a android friendly build of jaybird (no native for the
> moment)
>
> It is more complex than that: Firebird internally uses an implementation
> of the JCA ManagedConnectionFactory which is defined in the JEE JCA
> specification (one of the reasons Jaybird requires that
> mini-j2ee.jar/jaybird-full.jar). These classes are definitely not part of
> Android and would therefor require a significant rewrite(*), and also I am
> not sure if the JSE and/or JEE licensing would allow recompiling the
> required JCA, JTA and/or JDBC interfaces to Dalvik. That other drivers do
> this is - I think - not sufficient reason for us to do this (especially
> considering the other work that needs to be done on Jaybird).
I have seen some idea to make some of the methods stubs
but again is still a lot of work
http://download.oracle.com/berkeley-db/docs/je/3.3.62/HOWTO-Android.html

>
> But even more than that: in my opinion you really should not use JDBC on a
> mobile phone to connect to a database (except for a *mobile-local* db like
> SQLLite). Database connection protocols, especially those of Firebird, are
> not really suitable for use over the relatively high-latency mobile phone
> connections. Secondly the chattiness of the protocol and processing
> required might not be entirely battery friendly. As I said before, I think
> you are seriously better off (in terms of performance, security,
> flexibility and scalability) to build a webservice that is accessed by the
> phone app. The added benefit is a simpler, leaner phone app, a clear
> separation of concerns and a much simpler way to port the app to multiple
> phone platforms (you don't need to replicate the entire database connection
> part, just the UI, interfacing with the webservice and maybe some
> additional local logic).
you can use firebird protocol over ssh/ssl if you want
but that is another discussion :)


> *) A rewrite I am thinking of doing some time in the future, because I
> don't actually like the fact that JSE users need to include JEE interfaces
> (or use the jaybird-full.jar) for Jaybird to work, and it could (in theory)
> cause classloading conflicts for JEE users that use the jaybird-full.jar.
>
> That said, if someone wants to do the work: you are more than welcome to
> help out :)

It would be nice if firebird could talk jsonp or some rest protocol directly
Open http port , and then speak to the firebird directly
something like
http://www.flamingspork.com/blog/2011/04/21/http-json-alsosql-interface-to-drizzle/
>
> Mark