Search code examples
pythonwindows-server-2008firebird

python fdb, trying to connect to an external firebird 1.5 super server


I'm trying to connect to a Firebird 1.5 database that is located on a server, from my local machine with Python fdb libary. but I'm having no luck.
the server is windows 2008 server R1 running Firebird 1.5.6 as a service. It also has a System DSN called firebird.
How can i connect to it via python? I'm using this code:

import fdb
db = fdb.connect(host='192.168.40.28', database="C:\databases\database12.GDB", user='admin', password='admin')

but it generates this result:

Traceback (most recent call last):
  File "data.py", line 4, in <module>
    db = fdb.connect(host='192.168.40.28', database="C:\databases\database12.GDB", user='admin', password='admin')
  File "/usr/local/lib/python2.7/dist-packages/fdb/fbcore.py", line 666, in connect
    "Error while connecting to database:")
fdb.fbcore.DatabaseError: ('Error while connecting to database:\n- SQLCODE: -902\n- Unable to complete network request to host "192.168.40.28".\n- Failed to establish a connection.', -902, 335544721)

what am I doing wrong here?


Solution

  • Assuming that the IP 192.168.40.28 is correct my next quess would be that you don't have the port 3050 open (thats the default port for Firebird). Check your server's firewall and open the port. You can use some other port instead of 3050 by seting the RemoteServicePort parameter in the firebird.conf file, but then you have to set the port parameter in the connect method too.