Subject Re: [Firebird-Java] Android Connection
Author Mark Rotteveel
On 8-5-2019 17:23, stefano siraci@... [Firebird-Java] wrote:
> I developed several Java programs that use a JDBC connection to FB
> without any issue.
> Having to develop an Android app I thought that this matter should be
> easy to implement. Sadly until now I have not been able to get a
> connection to a DB.
> The driver is registered:
> I/System.out: Firebird JCA-JDBC driver version 2.2 registered with
> driver manager.
> but when I try to getConnection, it always gives me an exception error
> like:
> Rejecting re-init on previously-failed class
> java.lang.Class<org.firebirdsql.jca.FBManagedConnection>:
> java.lang.NoClassDefFoundError: Failed resolution of:
> Ljavax/transaction/xa/XAResource;
>
> Following a lot of net advises, I have tried several version of
> libraries, getting different exceptions, without any succesful.
> Please, is there anybody that has a working example, and the libraries
> used, better if is developed with Android  Studio.

The normal Jaybird library will not work under Android. There is an
Android port of Jaybird
(https://sourceforge.net/projects/androidjaybird/), but that project
seems to have been abandoned after version 2.2.4.

In general, you should not use JDBC drivers from Android. Using JDBC
from an Android device will be slow and insecure. If you want to connect
an Android application to a database, you should write a rest service
(eg in Java) that talks to your database, and make your Android
application talk to that rest service. It will usually perform better,
and is easier to secure than direct database access.

The error itself means that you do not have the JCA connector-api
dependency on the class path of your application. This dependency is
required by Jaybird.

Mark
--
Mark Rotteveel