OpenInformix / IfxPy

Informix native Python driver for scalable enterprise and IoT solutions.
Other
46 stars 22 forks source link

Help running it in Windows with Python 3.8.5 #50

Open jgerhdz opened 4 years ago

jgerhdz commented 4 years ago

Could you pleas help me to run it in windows?

  1. There is no pip install for the Ifxy

So I downloaded the 2 *.zip windows files from here put them in the same directory and renamed them

`fxPy> ls
\IfxPy
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        8/21/2020   1:52 PM            674 cuc_sql.py
-a----        2/17/2018   8:11 PM         113152 IfxPy.pyd
-a----        2/17/2018   8:11 PM          57760 IfxPyDbi.py`

This is my version of Python

IfxPy> python -VV Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]

This is the version of the informix SDC Client ibm.csdk.4.50.FC2.WIN.zip

This is my code. -a---- 8/21/2020 1:52 PM 674 cuc_sql.py

`import os

if os.name == 'nt' and hasattr(os, 'add_dll_directory'):
    informixdir = os.getenv('INFORMIXDIR', None)
    if informixdir and os.path.exists(informixdir):
        os.add_dll_directory(os.path.join(informixdir, "bin"))
import IfxPy

connStr = 'CLIENT_LOCALE=en_US.57372;DB_LOCALE=en_US.57372;SERVER=10.10.20.18;SERVICE=20532;DATABASE=unitydyndb;uid=administrator;pwd=cisco'
conn = IfxPy.connect(connStr, '', '')

sql = 'select count(*) from tbl_notifyq'
stmt = IfxPy.exec_immediate(conn, sql)
dictionary = IfxPy.fetch_assoc(stmt)

print('tbl_notifyq: ',  dictionary[''])

IfxPy.free_result(stmt)
IfxPy.free_stmt(stmt)

IfxPy.close(conn)`

I get this error
`Exception has occurred: ImportError
DLL load failed while importing IfxPy: The specified module could not be found.
  File "IfxPy\cuc_sql.py", line 7, in <module>
    import IfxPy`

Capture

Could you please help me with my issue?

jsagrera commented 4 years ago

Are you sure your CSDK version is 64-bit? That procmon trace shows an attempt to load the ICLIT09B.DLL (ODBC library) from the 32-bit Program Files (Program Files (x86)). Usually only 32-bit applications go there (but if you do a custom install you can put whatever you want).
Double check the version in that directory running "C:\Program Files (x86)\Informix Client-SDK\bin\setnet32.exe" Last tab should tell you the version. The suffix (either TCx or FCx) indicates if is 32-bit or 64-bit.

jgerhdz commented 4 years ago

Yes, this is the file I downloaded. "ibm.csdk.4.50.FC2.WIN.zip"

` jsagrera commented on Jan 24

4.10.TC9 (anything with a 'T' in the suffix) is a 32-bit version. Your Python has to match the same architecture as the CSDK libraries.
You should be able to download a Developer edition (free) 64-bit CSDK from https://www-01.ibm.com/marketing/iwm/iwm/web/preLogin.do?source=ifxdl&S_PKG=410FC8dewin&lang=en_US (you may need to create an IBM account). Something 4.10.FC12 or 4.50.FC2 should do fine. (**The 'F' in the name indicates a 64-bit version)**`

But I can uninstall it, could you please let me know which exact name of install file I could use?

jsagrera commented 4 years ago

First check the version of the current CSDK you have installed in "C:\Program Files (x86)\Informix Client-SDK". Run the setnet32.exe from "C:\Program Files (x86)\Informix Client-SDK\bin". If it is 4.50.FC2, it means you have a 64-bit version. Some how the name of the directories do not match what 4.50 uses.

The uninstall process has changed from version to version. With really old versions of CSDK you can do it from the Windows "Uninstall" control panel applet. New ones (>3.70) there is a "uninstallclientsdk.exe" in the Informix CSDK directory.

But there is no need to uninstall the old version. You can have more than one installed. The install will add the new version on top of the current PATH directory and update the ODBC registry definition.