How to connect to Firebird database in Python?

Asked

Viewed 1,923 times

1

I’m making an application myself Python that should connect to a bank Firebird. The application is running on a Linux and the bank in a Windows. My test file worked properly on the server Windows, but in the client, in case Linux, is locked in the connection class.

con = fdb.connect(host="192.168.43.252",database="C:/DB/BANCO.FDB", user="kenta", password="1234", port=3050)

cur = con.cursor()
cur.execute("select * from produto")
lista = cur.fetchall()

print(lista)

cur.close()
con.close()

What should I do to fix this problem?

[Updating]: After a long time it returns the error message:

 SQLCODE: -902 
 - Unable to complete network request to host "192.168.43.252".
 - Failed to estabilish a connection.
SQL error:
 -902, 335544721

[Updating]: I already installed the libfbclient2, but I can’t find the files:

  • /usr/lib/libfbclient.so. 2: Firebird 3.0
  • /usr/lib/libfbclient.so: Firebird 2.5
  • Can you ping from the client to the server? Can you connect the database to another client (for example dbeaver) other than python?

  • Ping works yes. Regarding another client I have not tested.

  • I discovered the error, in my windows firewall was not released the communication port 3050. I disabled the entire firewall for testing and communicated.

1 answer

1

The communication problem was in Firewall of Windows, the door 3050 was not released. - Kenta

Browser other questions tagged

You are not signed in. Login or sign up in order to post.