Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Python Firebird WinError 193 connection error

import fdb

def main():
    con = fdb.connect(dsn='C:\AKINSOFT\Wolvox8\Database_FB\SIRKET.FDB', user='sysdba', password='masterkey')

if __name__ == '__main__':
    main()

I wrote a simple code for connecting a Firebird database with Python and fdb. When I run this, I get an winerror 193

Traceback (most recent call last):
  File "C:\Users\grand\PycharmProjects\DatabaseTest\main.py", line 9, in <module>
    main()
  File "C:\Users\grand\PycharmProjects\DatabaseTest\main.py", line 5, in main
    con = fdb.connect(dsn='C:\AKINSOFT\Wolvox8\Database_FB\SIRKET.FDB', user='sysdba', password='masterkey')
  File "C:\Users\grand\PycharmProjects\DatabaseTest\venv\lib\site-packages\fdb\fbcore.py", line 803, in connect
    load_api(fb_library_name)
  File "C:\Users\grand\PycharmProjects\DatabaseTest\venv\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\grand\PycharmProjects\DatabaseTest\venv\lib\site-packages\fdb\ibase.py", line 1396, in __init__
    fb_library = WinDLL(fb_library_name)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
  OSError: [WinError 193] %1 geçerli bir Win32 uygulaması değil 

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The English error is "[WinError 193] %1 is not a valid Win32 application", and it means you’re trying to load a 32-bit DLL in a 64-bit process (or a 64-bit DLL in a 32-bit process). This means that you don’t have a valid fbclient.dll on the PATH that matches the bitness of your Python process, but do have one of the wrong bitness.

So, find out if you’re using a 32-bit or 64-bit Python (likely 64-bit these days), and use a Firebird installer of the appropriate bitness to install the client library.

If you don’t have or don’t want fbclient.dll on the PATH, you can also use fdb.load_api(..) or the fb_library_name connection property to specify the path to a fbclient.dll of the appropriate bitness.

As an aside, fdb has been superseded by the firebird-driver library.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading