Search code examples
delphiinterbasedelphi-10.4-sydneyiblite

Connecting to a remote instance of Interbase on Android using IBLite not working


In Delphi 10.4.1 I'm trying to build an Android application that connects to an instance of Interbase running on my laptop (which I can connect to remotely from my desktop). I get the exception:

Project Project6.apk raised exception class EIBNativeException with message '[FireDAC][Phys][IBLite]Unable to complete network request to host "192.168.1.58".
Failed to locate host machine.
Undefined service gds_db/tcp.'.

Connection Parameters:

Database=192.168.1.58:C:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\data\employee.gdb
User_Name=sysdba
Password=masterkey
DriverID=IB

Everything works fine if I connect to a local database, or run the app on Windows.

I've seen this demonstrated in XE7 (https://youtu.be/XAZQfYzvxHc?t=1384), but can't get it to work in 10.4.1.

What am I doing wrong?


Solution

  • If InterBase on your Windows machine is running on default instance 'gds_db', then it is probably using TCP socket on port 3050. Try changing your Android application's Database URL to the following so it includes the target 3050 port number. I am assuming that it is not automatically able to resolve 'gds_db' name on Android since the TCP socket service name is not defined on Android. On Desktop platforms like Windows, Linux, macOS, the InterBase installer updates the system services file to provide the translation of 'gds_db' name to 3050. Just providing a TCP socket port number is a failproof way to target an endpoint without need for name resolution.

    Database=192.168.1.58/3050:C:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\data\employee.gdb