Issue Details (XML | Word | Printable)

Key: CORE-5888
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Peshkov
Reporter: Karol Bieniaszewski
Votes: 2
Watchers: 5

If you were logged in you would be able to see more operations.
Firebird Core

Firebird server on Android has problem with numerics

Created: 10/Aug/18 08:52 AM   Updated: 18/Sep/19 06:40 PM
Component/s: Engine
Affects Version/s: 3.0.3
Fix Version/s: 3.0.5, 4.0 Beta 2

File Attachments: 1. File FBAndroid3.7z.001 (9.00 MB)
2. File FBAndroid3.7z.002 (6.27 MB)

Image Attachments:

1. Firebird3Deploy.png
(109 kB)
Android 8.0
Firebird version: LI-V3.0.3.32900
same with LI-V3.0.4.33054

QA Status: Cannot be tested
Test Details:
The sample that Alex gave works fine on any common (non-android) FB build:

C:\FB\30SS>isql /:e30
Database: /:e30, User: SYSDBA
SQL> recreate table test(x numeric(8,2));
SQL> insert into test values(3.62);
SQL> commit;
SQL> select * from test;


 Description  « Hide
Any select from Firebird containing numeric data type cause

"Fixed length column [F_NUMERIC] data length mismatch. Value length - [2], column fixed length - [8]"

when run from Delphi Firedac.
Same select throught firebird client to remote server works ok.

It looks like (from Firedac error message) that this is metadata/buffer retrurn problem to the client.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Karol Bieniaszewski added a comment - 13/Aug/18 08:40 AM
i have enabled trace on Firedac side and it looks like scale is wrongly reported

F_NUMERIC is declared as NUMERIC(18,2)

     . Col add [Index=1, SrcName="F_NUMERIC", SrcType=BCD, SrcSize=0, SrcPrec=18, SrcScale=254, Type=BCD, Size=0, Prec=18, Scale=254, OrigTabName="POLA", OrigColName="F_NUMERIC"]
     . Col add [Index=1, SrcName="F_NUMERIC", SrcType=BCD, SrcSize=0, SrcPrec=18, SrcScale=2, Type=BCD, Size=0, Prec=18, Scale=2, OrigTabName="POLA", OrigColName="F_NUMERIC"]

Vlad Khorsun added a comment - 28/Nov/18 08:42 PM
Could you try non-Firedac components ?
Or, could you run isql on Android ?

Karol Bieniaszewski added a comment - 28/Nov/18 09:04 PM - edited
I have tried but only succesfully with Firedac.I can try more if you realy wish. But i suppose problem is not Firedac itself.
And as tested previously using Firedac on Android and connecting to remote Firebird all works ok, including numerics.
But using Android embbeded FB numerics are broken.

>>could you run isql on Android

I do not know how to do this..

Alexander Peshkov added a comment - 06/May/19 12:28 PM
Karol, can you prepare binary I can run to reproduce the problem? It will be great to make it possible to connect to embedded and remote datasources.

Karol Bieniaszewski added a comment - 07/May/19 11:12 AM - edited
Hi Alexander
i have attached apk file if it is what you need.
It is compressed with 7zip into 2 volumes(as there is a limit of 10MB on the FBtracker)
1. run app
2. click "link"
   this assign VendorLib to "libfbclientembed" this is renamed file of
   and this also set FIREBIRD_LOCK variable
3. click on connect
   if succesfull then you should see version of Firebird below
4. Go to "Data" tab
you can change which field to query from the combobox - you can also type query self in the memo
5. click on "Open dataset"
you should see resultset in the grid or an error

for F_NUMERIC_3 error is different then for F_NUMERIC_2 or F_DECIMAL

if you have any questions or need to change something in the app feel free

emailx45 added a comment - 20/May/19 10:56 PM - edited
hi Karol,

is possible you send or show you did your app to access Firrbird embedded in Android.

I use RAD Studio 10.3.1 (Delphi), Android 7.0 Nougat, Firebird v3.04, BUT only have tested in MSWindows, and I would like to know config it to use in my test to Android.

I downloaded your APK and was installed in my Android and works showing the error that you talk.

its great for me because I would like to know how config one FMX project using Firebird embedded to Android.

I have some suites like UniDAC, FireDAC, IBX and others to test it.
I want only test i dont want create any app ok

then if you can send me this project test in a zip, and some text about, would be great.


Karol Bieniaszewski added a comment - 21/May/19 07:19 AM
Hi, thank you for the interest and test on Android 7.

You can not connect to Andorid from Firedac by only some configuration changing, sadly.
To connect from Delphi you must change source files and dissable Interbase To Go.

When the issue on the Firebird side will be fixed i will post to Embarcadero quality portal detailed description what should be changed to allow connection.
They must addapt this changes to support both Firebird and Interbase To Go as my modification work only with Firebird.
When i create RSP ticket i will post here the link and you can then change your source filess too.

emailx45 added a comment - 21/May/19 02:42 PM
hi Karol,

thanks for your reply.

I would like know only you created your project th0at at least show info about Firebird in your APK.
or be, just curiosity about how this project was done.
what components, whats Firebird files and folders was deployed etc.
you see?
really i know that Firebird is not prepared to Android, but my curiosity is more than my brain. hehehe :)))
if possible one zip will be great for while.


Alexander Peshkov added a comment - 23/May/19 12:00 PM
Let me confirm an issue using plain isql:

SQL> create database 'num.fdb';
SQL> create table numTest(x Numeric(8,2));
SQL> insert into numTest values(3.62);
SQL> commit;
SQL> select * from numTest;


SQL> show version;
ISQL Version: LI-V3.0.4.33054 Firebird 3.0
Server version:
Firebird/Linux/ARM (access method), version "LI-V3.0.4.33054 Firebird 3.0"
on disk structure version 12.2

Not an error but wrong result, and I'm sure it can make some clients raise error.

Karol Bieniaszewski added a comment - 23/May/19 04:01 PM
@Alexander Peshkov

Maybe this is the issue.
If you have some updated files to test i am interested :)

PS> If i can ask here - how do you run isql on Android?

I am not on the computer now i will attach screen from deploynment page if thsi is helpfull
But maybe earlier Alexander will fix the problem ;-)

emailx45 added a comment - 23/May/19 04:15 PM
hi @Karol
i'll wait. but the complete project (all files) in a zip will be great for that i can reproduce/compile in my Android and see like you did, and who know help with some idea. but if not possible for any cause, ok.


Alexander Peshkov added a comment - 23/May/19 04:49 PM
Here you can find binaries that should fix this problem:
Looks like an issue was due to default unsigned char on ARM (unlike x86 where char is signed by default).
Also I've fixed some issues that prevented running on relatively fresh Android version (I can't say for sure what I've used when did port a few years ago but you can imagine how old was it).
Cause most of fixes were compiler-flags related all binaries should better be replaced.

To run isql I did the following:
1. Installed ssh server on android device (I use SSHDroid, but suppose a lot of others will work for you).
Using ssh server has some advantages:
- I need not switch android to dev mode (i.e. it works at conditions maximum close to real world)
- I can use normal keyboard on noraml PC ;)

2. Copied using it firebird binaries and untarred them, next:

export FIREBIRD_LOCK=/data/data/ # /data/local/tmp does not work any more as 'good old' tmp
cd /data/data/
export LD_LIBRARY_PATH=../lib # my kernel does not understand appropriate option in ELF header
./isql is ready to run

BUT - on my device only using new binaries, there were a few issues breaking released binaries! Among them:
- executables should be linked with -pie option (kernel does not want to start other binaries at all)
- control upon the library pathname using dladdr() function does not work on Android - had to turn it off

I suppose second is not a problem for your android or you would never start embedded access. So please test how does it work now.

Karol Bieniaszewski added a comment - 24/May/19 02:05 PM
@Alexander Peshkov

It looks like fixed issue :)
It will be good if you attache fixed build to official download page
I then create ticket on Embarcadero site about official supported and working version of Firebird on Android :)

Thank you fro the fix

Alexander Peshkov added a comment - 25/May/19 08:07 AM
What about attaching fixed build to official download page - we do not publish intermediate binaries (may be it's time to have snapshot builds) but very soon plan to release 3.0.5.

Karol Bieniaszewski added a comment - 11/Jun/19 08:49 AM
As requested by users [maybe offtopic for the tracker] i have attached deployment screenshot from Delphi
"project name is FBAndroid4" - 4 is 4th attempt not firebird 4 ;-)

emailx45 added a comment - 11/Jun/19 12:11 PM
thanks, and lets try it

Geferson Dietze added a comment - 18/Sep/19 06:01 PM
How to get the file It is not included in the download.

Karol Bieniaszewski added a comment - 18/Sep/19 06:40 PM
It is simply renamed file
It was needed for my tests only