Open asfimport opened 3 years ago
Antoine Pitrou / @pitrou: I don't understand: why do you need a 32-bit Python to connect to Firebird?
Hezi Hershkovitz: I have an existing Firebird database, and it is using 32bit. I tried connecting to it using sqlalchemy when python was 64bit, but I got another error:
Antoine Pitrou / @pitrou: That error probably has nothing to do with the fact that Firebird is 32-bit, does it?
Hezi Hershkovitz:
I debugged traced it in VScode and saw that the "%1 is not a valid Win32 application" is happening when trying to open "fbclient.dll" which is I think the FireBird client dll file. I did dumpbin
and this dll file is 32bit:
>dumpbin /headers fbclient.dll
Microsoft (R) COFF/PE Dumper Version 14.29.30133.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file fbclient.dllPE signature foundFile Type: DLLFILE HEADER VALUES
14C machine (x86)
Therefore I don't see any other choice, other than connect to it using python 32bit.
P.S: I had similar issues connecting to the firebird database with flamerobin. It didn't work using flamerobin 64bit, only the 32bit version
Antoine Pitrou / @pitrou:
Ok, but it should be possible to use a 64-bit version of fbclient.dll
even for connecting to a 32-bit database server (presumably the wire protocol is bitness-agnostic?).
Hezi Hershkovitz: It will take me some time to try, maybe I will be able to check it tomorrow
Hezi Hershkovitz: I tried. With 64bit fbclient.dll running on top of 32bit python I am getting an error:
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\util\compat.py", line 207, in raise_
raise exception
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\pool\base.py", line 661, in __connect
self.dbapi_connection = connection = pool._invoke_creator(self)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\engine\create.py", line 590, in connect
return dialect.connect(*cargs, **cparams)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sqlalchemy\engine\default.py", line 584, in connect
return self.dbapi.connect(*cargs, **cparams)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\fdb\fbcore.py", line 800, in connect
load_api(fb_library_name)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\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\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\fdb\ibase.py", line 1396, in __init__
fb_library = WinDLL(fb_library_name)
File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
So I don't see an option to connect to this 32bit firebird database from superset.
Antoine Pitrou / @pitrou: I meant use the 64bit fbclient.dll with 64bit Python (and 64bit PyArrow).
Hezi Hershkovitz: I tried it now. I am still getting the same error.
python 3.7.8 64bit:
(venv) C:\Superset>python
Python 3.7.8 (tags/v3.7.8:4b47a5b6ba, Jun 28 2020, 08:53:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
64bit dll:
>dumpbin /headers fbclient.dll
Microsoft (R) COFF/PE Dumper Version 14.29.30133.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file fbclient.dllPE signature foundFile Type: DLLFILE HEADER VALUES
8664 machine (x64)
Error:
File "C:\Superset\venv\lib\site-packages\sqlalchemy\engine\create.py", line 590, in connect
return dialect.connect(*cargs, **cparams)
File "C:\Superset\venv\lib\site-packages\sqlalchemy\engine\default.py", line 584, in connect
return self.dbapi.connect(*cargs, **cparams)
File "C:\Superset\venv\lib\site-packages\fdb\fbcore.py", line 800, in connect
load_api(fb_library_name)
File "C:\Superset\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:\Superset\venv\lib\site-packages\fdb\ibase.py", line 1396, in __init__
fb_library = WinDLL(fb_library_name)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
In addition, I tried with 32bit dll and python and I was able to connect to the database using sqlalchemy.
Antoine Pitrou / @pitrou: That seems rather unexpected. Are you sure fdb is picking the right DLL file? Perhaps you have the 32-bit version in your system directories?
Hezi Hershkovitz: I am sure, because the fbclient.dll is located in the folder where I run the script. Without the dll file there, the error was something different, about not finding the dll file.
Following as have exact same use case and issue of 32bit here
I have the exact same issue as was discussed here: https://github.com/apache/arrow/issues/6902
My problem is that I am trying to connect apache superset to 32bit Firebird version, and as a result I must use python 32bit.
Is there a way to overcome this issue? Any plans to support 32bit in the future?
Environment: python 3.7.8 Reporter: Hezi Hershkovitz
Note: This issue was originally created as ARROW-14170. Please see the migration documentation for further details.