G
G
Gleb Lukashonok2021-10-12 00:05:12
Python
Gleb Lukashonok, 2021-10-12 00:05:12

How to connect to Firebird?

How to connect to the base? About a year ago I connected in exactly the same way and everything worked, but now I don’t want to in another project.
Here is the code:

import fdb

con = fdb.connect(dsn='127.0.0.1:D:/Dev/Python/Electra-AC_face-recognition/train.fdb', user='SYSDBA',
                      password='masterkey')
cur = con.cursor()
cur.execute("select * from USERS")
result= cur.fetchall()
print(result)

But he breaks off on the first line. Here is the error:

Traceback (most recent call last):
  File "D:/Dev/Python/Electra-AC_face-recognition/training_model.py", line 147, in <module>
    firebird()
  File "D:/Dev/Python/Electra-AC_face-recognition/training_model.py", line 130, in firebird
    con = fdb.connect(dsn='127.0.0.1:D:/Dev/Python/Electra-AC_face-recognition/train.fdb', user='SYSDBA',
  File "C:\Users\Hleb\AppData\Local\Programs\Python\Python38\lib\site-packages\fdb\fbcore.py", line 803, in connect
    load_api(fb_library_name)
  File "C:\Users\Hleb\AppData\Local\Programs\Python\Python38\lib\site-packages\fdb\fbcore.py", line 231, in load_api
    setattr(sys.modules[__name__], 'api', ibase.fbclient_API(fb_library_name))
  File "C:\Users\Hleb\AppData\Local\Programs\Python\Python38\lib\site-packages\fdb\ibase.py", line 1396, in __init__
    fb_library = WinDLL(fb_library_name)
  File "C:\Users\Hleb\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 не является приложением Win32

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gleb Lukashonok, 2021-10-12
@Bombesko

Python version - 3.8.9, Firebird - 2.5.9
I found the solution! The matter is that Python was x64, and Firebird x32. Reinstalling Firebird helped :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question