FirebirdSQL/python3-driver

Failed to establish a connection to the server on the specified port

ant-zuev opened this issue · 0 comments

If I specify a port value other than 3050 in server configuration, I will get an error when trying to connect to the server listening this port.

Run server on port 3051:
./firebird -a -p 3051

Check connection:

# isql -u sysdba -p masterkey localhost/3051:employee
Database: localhost/3051:employee, User: SYSDBA

Register Firebird server

from firebird.driver import connect_server, driver_config

srv_cfg = """[main_server]
host = localhost
port = 3051
user = SYSDBA
password = masterkey
"""
driver_config.register_server('main_server', srv_cfg)

Attach to 'main' server

con = connect_server('main_server')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/anton/env/lib/python3.10/site-packages/firebird/driver/core.py", line 5571, in connect_server
    svc = provider.attach_service_manager(host, spb_buf)
  File "/home/anton/env/lib/python3.10/site-packages/firebird/driver/interfaces.py", line 1302, in attach_service_manager
    self._check()
  File "/home/anton/env/lib/python3.10/site-packages/firebird/driver/interfaces.py", line 111, in _check
    raise self.__report(DatabaseError, self.status.get_errors())
firebird.driver.types.DatabaseError: Unable to complete network request to host "localhost".
-Failed to establish a connection.

I think the problem is in connect_server(). Port is not added to host: