Subject Re: Remote connections
Author Adrian Pronk
A few days ago, Brad Pepers had problems connecting to Windows databases
from Linux ISQL. He later said that it was a VMWare issue. Today I had
the same problem. It wasn't a VMWare issue. Here are the steps I went
through to solve it:

>>> $ isql 192.168.1.1:/x:/Databases/XxxxxxCopyOfHost.gdb
>>> Statement failed, SQLCODE = -902
>>>
>>> Unable to complete network request to host "backupserver".
>>> -Failed to locate host machine.
>>> -Undefined service x/tcp.
>>> Use CONNECT or CREATE DATABASE to specify a database
>>> SQL>

Right, so it can't connect, but it managed to translate the IP address
into a host name. I guess this machine must know the address of
backpuserver.
Lets try accessing a database on my machine using an IP-address:

>>> $ isql 127.0.0.1:/xxxxxx.gdb
>>> Database: 127.0.0.1:/xxxxxx.gdb
>>> SQL>

That worked. Lets try replacing the ":" with "|" like you sometimes see
in web-browsers:

>>> $ isql 192.168.1.1:/x\|/Databases/XxxxxxCopyOfHost.gdb
>>> Statement failed, SQLCODE = -902
>>>
>>> I/O error for file "/x|/Databases/XxxxxxCopyOfHost.gdb"
>>> Use CONNECT or CREATE DATABASE to specify a database
>>> SQL>

That looks like it's connecting to the machine successfully but doesn't
like the file name. Lets try a syntactically valid path name:

>>> $ isql 192.168.1.1:/x/Databases/XxxxxxCopyOfHost.gdb
>>> Statement failed, SQLCODE = -902
>>>
>>> I/O error for file "/x/Databases/XxxxxxCopyOfHost.gdb"
>>> -Error while trying to open file
>>> -The system cannot find the path specified.
>>>
>>> Use CONNECT or CREATE DATABASE to specify a database
>>> SQL>

Ok, file not found, as expected. Lets try a host name instead of an
IP address:

>>> $ isql backupserver:/x/Databases/XxxxxxCopyOfHost.gdb
>>> Statement failed, SQLCODE = -902
>>>
>>> I/O error for file "/x/Databases/XxxxxxCopyOfHost.gdb"
>>> -Error while trying to open file
>>> -The system cannot find the path specified.
>>>
>>> Use CONNECT or CREATE DATABASE to specify a database
>>> SQL>

Same as above. Lets try the correct file path using a host name:

>>> $ isql backupserver:/x:/Databases/XxxxxxCopyOfHost.gdb
>>> Statement failed, SQLCODE = -902
>>>
>>> Unable to complete network request to host "backupserver".
>>> -Failed to locate host machine.
>>> -Undefined service x/tcp.
>>> Use CONNECT or CREATE DATABASE to specify a database
>>> SQL> quit;

Hey! I didn't pay attention to this before, but it's complaining about
x/tcp
being an invalid service. From this I infer that the second colon delimits
an optional tcp port similar to an http URL:

>>> $ isql backupserver:3050:x:/Databases/XxxxxxCopyOfHost.gdb
>>> Statement failed, SQLCODE = -902
>>>
>>> Unable to complete network request to host "3050".
>>> -Failed to locate host machine.
>>> -The specified name was not found in the hosts file or Domain
Name Services.
>>> Use CONNECT or CREATE DATABASE to specify a database
>>> SQL> quit;

Ok, so it thinks the host is "3050". Maybe it needs a preceding slash...

>>> $ isql backupserver:/3050:x:/Databases/XxxxxxCopyOfHost.gdb
>>> Statement failed, SQLCODE = -902
>>>
>>> Unable to complete network request to host "backupserver".
>>> -Failed to locate host machine.
>>> -Undefined service 3050/tcp.
>>> Use CONNECT or CREATE DATABASE to specify a database
>>> SQL> quit;

Now we're back to where we were. Hmmm, it seems to be calling
getservbyname(),
even though I specified a numeric port. Now I'll have to look up the
service
name in /etc/services and see if its there:

>>> $ grep 3050 /etc/services
>>> gds_db 3050/tcp # InterBase Database Remote Protocol

Finally, lets try again with the service name:

>>> $ isql backupserver:/gds_db:x:/Databases/XxxxxxCopyOfHost.gdb
>>> Database:
backupserver:/gds_db:x:/Databases/XxxxxxCopyOfHost.gdb
>>> SQL>

Hey, it worked! I've never seen that syntax documented.
--
Adrian