Giter Club home page Giter Club logo

ifxpy's People

Contributors

chestnutsj avatar cypres-it avatar imgbotapp avatar jaimundada avatar jinming-xiao avatar jsagrera avatar msatyan avatar rhtpandeyin avatar shilpa-jadhav avatar zdenop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ifxpy's Issues

multiple connections with same DBSERVERNAME

two informix server has same DBSERVERNAME.
how to use?

constr HOST is not working。

ConStr1 = "SERVER=sop_tcp;DATABASE=abc;HOST=10.111.18.18;SERVICE=9088;UID=id;PWD=ps;"

ConStr2 = "SERVER=sop_tcp;DATABASE=abc;HOST=10.111.18.20;SERVICE=9088;UID=id2;PWD=ps2;"

sqlhosts:

sop_tcp onsoctcp        10.111.18.18     9088
sop_tcp onsoctcp        10.111.18.20   9088

problem with cron (SQLCODE=-23101)

I try to run script using IfxPy with cron.
My script works when I run it under user. But it fails when it iss run from cron. I was able to replicate problme with sudo -H:

sudo -H python3 bots/test/cn_test_cron.py
[sudo] password for root:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/IfxPyDbi.py", line 503, in connect
    conn = IfxPy.connect(ConStr, '', '', conn_options)
Exception: [Informix][Informix ODBC Driver][Informix]Unspecified System Error =  -23101. SQLCODE=-23101

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bots/test/cn_test_cron.py", line 9, in <module>
    connection = dbapi2.connect(con_str)
  File "/usr/lib64/python3.6/site-packages/IfxPyDbi.py", line 506, in connect
    raise _get_exception(inst)
IfxPyDbi.Error: ifx_pydb::Error: [Informix][Informix ODBC Driver][Informix]Unspecified System Error =  -23101. SQLCODE=-23101

Any idea how to fix it?

Informix and Python 3.8.1

After updating Slackware it gave me a new Python version 3.8.1
Now my python scripts fails.
I ran the upgrade command:
pip3 install ifxpy --upgrade
ERROR: Could not find a version that satisfies the requirement ifxpy (from versions: none)
ERROR: No matching distribution found for ifxpy
I get the above error...

On the https://pypi.org/project/IfxPy/ site it only shows these available options:
Programming Language
Python :: 2.7
Python :: 3.4
Python :: 3.5
Python :: 3.6
Python :: 3.7
Python :: Implementation :: CPython

It looks like the Python :: 3.8 version is not available...

I also had the same issue with a script that talks to a MongoDB database.
I ran the upgrade command "pip3 install pymongo --upgrade" and it fixed the problem.

Is Informix support being ended or just not a priority?

Thanks for any help you can provide.
Eric

test_000_PrepareDb.IfxPyTestCase: Smart-large-object error. SQLCODE=-9810

I successfully build 64-bit version of IfxPy.so for AIX.
I'm usinq python3 and CSDK_4.50.FC3
The first test test_001_ConnDb.py finished OK,

The second test crashed:

test_000_PrepareDb (test_000_PrepareDb.IfxPyTestCase) ... ERROR

=====================================================
ERROR: test_000_PrepareDb (test_000_PrepareDb.IfxPyTestCase)

Traceback (most recent call last):
File "/itxwork/RO/t2/IfxPy/IfxPy/tests/test_000_PrepareDb.py", line 20, in test_000_PrepareDb
obj.assert_expect(self.run_test_000)
File "/itxwork/RO/t2/IfxPy/IfxPy/testfunctions.py", line 82, in assert_expect
self.assertEqual(self.capture(testFuncName), self.expected_IDS(callstack[1][1]))
File "/itxwork/RO/t2/IfxPy/IfxPy/testfunctions.py", line 50, in capture
func()
File "/itxwork/RO/t2/IfxPy/IfxPy/tests/test_000_PrepareDb.py", line 93, in run_test_000
result = IfxPy.execute(stmt)
Exception: Statement Execute Failed: [Informix][Informix ODBC Driver][Informix]Smart-large-object error. SQLCODE=-9810

What's wrong with it? Any suggestion?

error in IfxPy setup command: use_2to3 is invalid.

I tried to install IfxPy on windows 10 64bit but it fails:

pip install ifxpy
Collecting ifxpy
  Downloading IfxPy-3.0.5.tar.gz (155 kB)
     |████████████████████████████████| 155 kB 1.3 MB/s
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Python\Python39\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\zdeno\\AppData\\Local\\Temp\\pip-install-zvv5p8yr\\ifxpy_c8342a8b88f54029a6680c183faf2463\\setup.py'"'"'; __file__='"'"'C:\\Users\\zdeno\\AppData\\Local\\Temp\\pip-install-zvv5p8yr\\ifxpy_c8342a8b88f54029a6680c183faf2463\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\zdeno\AppData\Local\Temp\pip-pip-egg-info-d6o7ebwt'
       cwd: C:\Users\zdeno\AppData\Local\Temp\pip-install-zvv5p8yr\ifxpy_c8342a8b88f54029a6680c183faf2463\
  Complete output (5 lines):
  Detected 64-bit Python
  Downloading : https://hcl-onedb.github.io/odbc/OneDB-Win64-ODBC-Driver.zip
  error in IfxPy setup command: use_2to3 is invalid.
  Extracting Windows ODBC files : https://hcl-onedb.github.io/odbc/OneDB-Win64-ODBC-Driver.zip
  Smart Triggers are enabled.
  ----------------------------------------

my python version is 3.9.9 and setuptools 58.1.0.

execute_many does not work?

Any idea when it will be implemented?

{ "execute_many", (PyCFunction)IfxPy_execute_many, METH_VARARGS, "Execute SQL with multiple rows." }, // TODO

Fetch results from a specific row

I want to start fetching results from a specific row (let's say 6000) in the database.
I've used the code below:

import IfxPy
import pandas as pd
sql = "select * from mytable"
stmt = IfxPy.exec_immediate(conn, sql)

dictionary = IfxPy.fetch_assoc(stmt,6000)

res = []
while dictionary != False:
    res.append(dictionary)
    dictionary = IfxPy.fetch_assoc(stmt)
result = pd.DataFrame(res)
result.to_excel("output.xlsx",index=False) 

But I'm getting this error:

Exception: Fetch Failure: [Informix][Informix ODBC Driver]Fetch type out of range. SQLCODE=-11086

IfxPy import issue in Thonny IDE

When i try run a pyton sample in Thonny this error message is showed :

%Run sample.py
Traceback (most recent call last):
File "/home/pi/pysamples/sample.py", line 1, in
import IfxPy
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 305, in _custom_import
module = self._original_import(*args, **kw)
ImportError: libifdmr.so: cannot open shared object file: No such file or directory.

But in console mode, the same sample python file run fine...

pi@raspberrypi:~/pysamples $ python3 sample.py
-- Record 1 --1-BOYS 4/5, 6/7, 8, 10/12, 14/16, 18, 20
-- Record 2 --2-BOYS XS, S, M, L, XL, 2XL, 3XL
-- Record 3 --3-BOYS XS(4-5), S(6-7), M(8), L(10-12), XL(14-16, XXL(18), 10/12H, 14/16H
-- Record 4 --4-GIRLS 4/5, 6/6X, 7/8, 10/12, 14/16
-- Record 5 --5-GIRLS 4, 5, 6, 7, 8, 10, 12, 14

I am using Os Rasbian buster + Python 3x + IfxPy database Driver.

The libifdmr.so is located in {INFORMIXDIR}/lib/cli (this is the env) :

SHELL=/bin/bash
COLORTERM=truecolor
XDG_CONFIG_DIRS=/etc/xdg
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_MENU_PREFIX=lxde-pi-
INFORMIXDIR=/opt/ibm/informix
LANGUAGE=en_US.UTF-8
_LXSESSION_PID=512
SSH_AUTH_SOCK=/tmp/ssh-YqELtJu2PGgK/agent.512
XDG_CONFIG_HOME=/home/pi/.config
DESKTOP_SESSION=LXDE-pi
SSH_AGENT_PID=554
NO_AT_BRIDGE=1
XDG_SEAT=seat0
PWD=/opt/ibm/informix/lib/cli
LOGNAME=pi
XDG_SESSION_DESKTOP=lightdm-xsession
QT_QPA_PLATFORMTHEME=qt5ct
XDG_SESSION_TYPE=x11
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
XAUTHORITY=/home/pi/.Xauthority
XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/pi
HOME=/home/pi
LANG=en_US.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:*.xspf=00;36:
XDG_CURRENT_DESKTOP=LXDE
VTE_VERSION=5402
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
ODBCINI=/etc/odbc.ini
XDG_SESSION_CLASS=user
TERM=xterm-256color
USER=pi
DISPLAY=:0.0
SHLVL=1
XDG_VTNR=7
XDG_SESSION_ID=c1
LD_LIBRARY_PATH=/opt/ibm/informix/lib:/opt/ibm/informix/lib/cli:/opt/ibm/informix/lib/esql:
XDG_RUNTIME_DIR=/run/user/1000
LC_ALL=en_US.UTF-8
XDG_DATA_DIRS=/usr/local/share:/usr/share/raspi-ui-overrides:/usr/share:/usr/share/gdm:/var/lib/menu-xdg
PATH=/home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/opt/ibm/informix/bin
GDMSESSION=lightdm-xsession
SAL_USE_VCLPLUGIN=gtk3
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
TEXTDOMAIN=Linux-PAM
_=/usr/bin/env
OLDPWD=/opt/ibm/informix/lib

Any ideas to solve this issue in Thonny?,

Your help is great appreciated!!!!

Examples/DbAPI_Sample_Params.py fails with Exception: [Informix][Informix ODBC Driver]Driver not capable. SQLCODE=-11092

I tried to run the Examples/DbAPI_Sample_Params.py on ubuntu 16.04 with python2.7 as well as python3. With both I get the following Exception:

[Informix][Informix ODBC Driver]Driver not capable. SQLCODE=-11092

However python2 fails at UPDATE t1 SET c2 = 'Wednesday!' WHERE c1 = (?), whereas python3 fails at INSERT INTO t1 VALUES (?,?,?,?) days.

Bellow lines starting with //// are print statements to see where it fails.

python2:

$ python2 DbAPI_Sample_Params.py
//// create table t1 ( c1 int, c2 char(20), c3 int, c4 int )
//// INSERT INTO t1 VALUES (?,?,?,?) days
//// UPDATE t1 SET c2 = 'Wednesday!' WHERE c1 = 4
//// UPDATE t1 SET c2 = 'Wednesday!' WHERE c1 = (?)
Traceback (most recent call last):
  File "DbAPI_Sample_Params.py", line 43, in <module>
    cur.execute("UPDATE t1 SET c2 = 'Wednesday!' WHERE c1 = (?)", (c1_val,))
  File "/usr/local/lib/python2.7/dist-packages/IfxPyDbi.py", line 1219, in execute
    self._execute_helper(parameters)
  File "/usr/local/lib/python2.7/dist-packages/IfxPyDbi.py", line 1115, in _execute_helper
    for param in parameters:
Exception: [Informix][Informix ODBC Driver]Driver not capable. SQLCODE=-11092

python3:

$ python3 DbAPI_Sample_Params.py
//// create table t1 ( c1 int, c2 char(20), c3 int, c4 int )
//// INSERT INTO t1 VALUES (?,?,?,?) days
Exception: [Informix][Informix ODBC Driver]Driver not capable. SQLCODE=-11092

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/test/.local/lib/python3.5/site-packages/IfxPyDbi.py", line 576, in commit
    return_value = IfxPy.commit(self.conn_handler)
SystemError: <built-in function commit> returned a result with an error set

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "DbAPI_Sample_Params.py", line 35, in <module>
    conn.commit ()
  File "/home/test/.local/lib/python3.5/site-packages/IfxPyDbi.py", line 578, in commit
    raise _get_exception(inst)
IfxPyDbi.Error: ifx_pydb::Error: SystemError('<built-in function commit> returned a result with an error set',)

Here are some details about the Informix version we use:

Informix 12.10fc11
IBM Informix Dynamic Server Version 12.10.FC11WE 
IBM/Informix C++ API 4.10.FC11 
IBM/Informix EMBEDDED SQL for C Version 4.10.FC11 
IBM/Informix LIBASF LIBRARY Version 4.10.FC11 
IBM/Informix LIBDMI LIBRARY Version 4.10.FC11 
IBM/Informix LIBGEN LIBRARY Version 4.10.FC11 
IBM/Informix LIBOS LIBRARY Version 4.10.FC11 
IBM/Informix LIBSQL LIBRARY Version 4.10.FC11 
IBM/Informix ODBC LIBRARY Version 4.10.FC11 
IBM/Informix-Client SDK Version 4.10.FC11 
INFORMIX LIBGLS LIBRARY Version 6.00.FC12 

Any idea what causes this Error or how to fix it?

Clarification of components of the SDK used

Asking to package the entire CSDK is just unreal.

For example the nodejs library states that it's dependency is only:

Dependencies
IBM Informix ESQL/C which can be installed using IBM Informix CSDK.

Which is only a part of the entire CSDK. Otherwise if i want to deploy it in a lambda function on AWS i won't be able, because the entire CSDK weigths more than 300 MB IMHO.

Boolean object not properly retrieved

I figured out that boolean object are not retrieved while querying object in sqlalchemy

libraries in use:
SQLAlchemy==1.3.13
IfxAlchemy==1.0.1
IfxPy==3.0.2

from sqlalchemy import Column, INTEGER, Boolean, DateTime, VARCHAR
from Database import Database


class Team(Database.get_model_by_name('uccx016') or Database.get_model_by_name('uccx017')):

    __tablename__ = 'team'
    __table_args__ = {"schema": "informix"}

    teamid = Column(INTEGER, primary_key=True, autoincrement=True, default=None, nullable=False)
    profileid = Column(INTEGER, nullable=False)
    teamname = Column(VARCHAR(50), nullable=False)
    active = Column(Boolean, nullable=False)
    dateinactive = Column(DateTime, nullable=False)


teams = Database.get_session_by_name('uccx016').query(Team).all()

This will retrieve all the content for the 'informix.team' table except for the boolean column that is always set to None even if the value is set to true or false within the table.

ImportError: DLL load failed while importing _openmp_helpers: %1 is not a valid Win32 application.

ImportError Traceback (most recent call last)
in
----> 1 from sklearn.model_selection import train_test_split
2 from sklearn.linear_model import LinearRegression

G:\Anaconda\lib\site-packages\sklearn_init_.py in
73 from . import __check_build
74 from .base import clone
---> 75 from .utils._show_versions import show_versions
76
77 __check_build # avoid flakes unused variable error

G:\Anaconda\lib\site-packages\sklearn\utils_show_versions.py in
10 import importlib
11
---> 12 from ._openmp_helpers import _openmp_parallelism_enabled
13
14

ImportError: DLL load failed while importing _openmp_helpers: %1 is not a valid Win32 application.

I am getting this error while I am trying to inport sklearn in jupyter-lab.
Please help
Thank you

column type is byte,query result is incorrect

stmt = IfxPy.exec_immediate(conn ,sql)
res = IfxPy.fetch_assoc(stmt)
print(type(res))
IfxPy.free_result(stmt)
IfxPy.free_stmt(stmt)
print(res)

query reuslt

<class 'dict'>
{'yuansj': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'jiaoym': '8982'}

\x00 is incorrect..

DBAPI: Is it possible to execute procedure with parameters?

I' m trying to execute a Stored procedure like this:
cur.execute("EXECUTE PROCEDURE sp_test(?)", ("HELLO",))

But i'm getting this error:
ifx_pydb::DatabaseError: Exception('Binding Error: [Informix][Informix ODBC Driver]Invalid application buffer type. SQLCODE=-11116')

I also tried the method (as per the https://www.python.org/dev/peps/pep-0249/#callproc):
cur.callproc("sp_test", ("TEST",))

Right now the only way i can execute it is like this:
param = "HELLO"
cur.execute("EXECUTE PROCEDURE sp_test('"+param+"')")

But is not a very good practice to do it like that.

Is there even a way to call an IFX sp with parameters?

The sp param's signature is like this:
CREATE PROCEDURE sp_test(greeting CHAR(5))

Thank you in advance.

Memory leak

Hello,

I'm using your library with Python3 to read Informix database. But I noticed that I have memory leak when I'm using this line : dictionary = IfxPy.fetch_assoc(stmt)

I was thinking that was my code but I commented all my code and I let just this line and the memory increase every time inside my while True: loop.

I created a question on stackoverflow https://stackoverflow.com/questions/52838748/python3-system-service-memory-leak

Hope you can help me.

Thanks

Cant import IfxPy

Hello, and thanks for creating all these great tools for using Python with Informix!
I am fairly new at Python, being an old fashion Informix DBA, but I want to learn.
I am running into an issue. I hope you can help me.

Problem: Cannot import IfxPy directly or through IfxPiDbi in Windows 10 64-bit
After installing PyCharm using python 3.8.5 I cannot directly import IfxPy.
Note: I also installed CSDK for Informix 64bit. This is my INFORMIXDIR.

My env
HKEY_CURRENT_USER\Environment
CSDK_HOME REG_SZ C:\Program Files\IBM Informix Client-SDK
INFORMIXDIR REG_SZ C:\Program Files\IBM Informix Client-SDK
INFORMIXSERVER REG_SZ ibm229
LD_LIBRARY_PATH REG_EXPAND_SZ %INFORMIXDIR%\lib;%INFORMIXDIR%\lib\esql;%INFORMIXDIR%\lib\cli
Path REG_EXPAND_SZ %INFORMIXDIR%\bin;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;%PyCharm%;%PyCharm Community Edition%;C:\Program Files (x86)
Google\Cloud SDK\google-cloud-sdk\bin;
PSModulePath REG_EXPAND_SZ %HomeDrive%%HomePath%\Documents\WindowsPowerShell\Modules;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platfo
rm\PowerShell
PyCharm REG_SZ C:\Program Files\JetBrains\PyCharm 2020.3.5\bin;
PyCharm Community Edition REG_SZ C:\Program Files\JetBrains\PyCharm Community Edition 2020.3.5\bin;

Heres my steps

Created a new project Informix.
Installed wheel, then IfxPy from settings/Project Informix
Both said they were installed successfully

IfxPy 3.0.5
Wheel 0.36.2

Created a new python file IfxPy_connect
Import IfxPy gives error
No module named IfxPy

Import IfxPyDbi works fine.
Dir(IfxPyDbi) shows IfxPy module, but cannot access any of its functions.

I looked in the site packages
C:\Users\pf556315\PycharmProjects\Informix\venv\Lib\site-packages

I see IfxPyDbi.py and an extension IfxPy.cp38-win_amd64.pyd
There is no IfxPy.py file.

Any help is appreciated!

Ed

Error 404: not found from dependency https://hcl-onedb.github.io/odbc/Unknown on macos

(venv-38) bash-3.2$ pip install IfxPy
Looking in indexes: http://localhost:3141/root/pypi/+simple/
Collecting IfxPy
  Downloading http://localhost:3141/root/pypi/%2Bf/788/4365e04dd2a00/IfxPy-3.0.5.tar.gz (155 kB)
     |████████████████████████████████| 155 kB 51.4 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /Users/david/.local/share/virtualenvs/analytics-ingest-platform-ey8Fc8jM/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/f1/0jzpddz54_7fr79d9szr58s80000gn/T/pip-install-yf55_wyn/ifxpy/setup.py'"'"'; __file__='"'"'/private/var/folders/f1/0jzpddz54_7fr79d9szr58s80000gn/T/pip-install-yf55_wyn/ifxpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/f1/0jzpddz54_7fr79d9szr58s80000gn/T/pip-pip-egg-info-4_3pganc
         cwd: /private/var/folders/f1/0jzpddz54_7fr79d9szr58s80000gn/T/pip-install-yf55_wyn/ifxpy/
    Complete output (19 lines):
    Detected 64-bit Python
    Downloading : https://hcl-onedb.github.io/odbc/Unknown
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/f1/0jzpddz54_7fr79d9szr58s80000gn/T/pip-install-yf55_wyn/ifxpy/setup.py", line 98, in <module>
        file_stream = BytesIO(request.urlopen(url).read())
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
        return opener.open(url, data, timeout)
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 531, in open
        response = meth(req, response)
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 640, in http_response
        response = self.parent.error(
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 569, in error
        return self._call_chain(*args)
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
        result = func(*args)
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 649, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 404: Not Found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
(venv-38) bash-3.2$ 

ModuleNotFoundError: No module named 'IfxPyDbi'

After upgrade IfxPy from 3.0.1 to 3.0.4 using pip, i have this error:

ModuleNotFoundError: No module named 'IfxPyDbi'

on uninstall ifxpy v3.0.4:
(microservicio) [gsandi@api microservicio]$ pip3 uninstall ifxpy
Found existing installation: IfxPy 3.0.4
Uninstalling IfxPy-3.0.4:
Would remove:
/home/gsandi/microservicio/lib/python3.6/site-packages/IfxPy-3.0.4.dist-info/*
/home/gsandi/microservicio/lib/python3.6/site-packages/IfxPy.cpython-36m-x86_64-linux-gnu.so

on v 3.0.1:
(microservicio) [gsandi@api microservicio]$ pip3 uninstall ifxpy
Found existing installation: IfxPy 3.0.1
Uninstalling IfxPy-3.0.1:
Would remove:
/home/gsandi/microservicio/lib/python3.6/site-packages/IfxPy-3.0.1.dist-info/*
/home/gsandi/microservicio/lib/python3.6/site-packages/IfxPy.cpython-36m-x86_64-linux-gnu.so
/home/gsandi/microservicio/lib/python3.6/site-packages/IfxPyDbi.py

Why the file ifxpydbi.py is not copied during installation of the new version of IfxPy?

Rgrds.

Problems with pipenv

When using Pipenv, it currently fails to be able to resolve the correct version. This may be the same issue as #26 but I am reporting it in case it is a different problem.

Informix to AWS Glue

I was trying to connect the Informix with AWS Glue using JDBC.
I installed the Informix Developer version in my windows system and created an instace assigned with host ip and port. After I uploaded the informic jdbc jar file in s3 and tried to connect with AWS glue. It is not working.
My informix server instance is running and the port is on, but still something I went wrong.

Can any help me with this issue what is the actual process for it.

VS 2019 build fails with syntax error

Hello,

current code fails when I tried to build IfxPy on windows (64bit, clientsdk.4.10.FC9DE, python-3.8.3 and VS2019):

f:\Project\IfxPy\IfxPy>python setup.py build
Detected 64-bit Python
running build
running build_py
running build_ext
building 'IfxPy' extension
c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -If:/Developments/Python-3.8.4\include "-Ic:/Program Files/IBM Informix Client SDK\incl\cli" "-IC:\Program Files\Python38\include" "-IC:\Program Files\Python38\include" "-Ic:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\ATLMFC\include" "-Ic:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" "-Ic:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\ATLMFC\include" "-Ic:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcifxpyc.c /Fobuild\temp.win-amd64-3.8\Release\ifxpyc.obj
ifxpyc.c
ifxpyc.c(70): error C2061: syntax error: identifier 'gSmartTriggerRegister'
ifxpyc.c(70): error C2059: syntax error: ';'
ifxpyc.c(70): error C2059: syntax error: '['
ifxpyc.c(71): error C2061: syntax error: identifier 'gopenSmartTrigger'
ifxpyc.c(71): error C2059: syntax error: ';'
ifxpyc.c(72): error C2061: syntax error: identifier 'gJoinSmartTrigger'
ifxpyc.c(72): error C2059: syntax error: ';'
ifxpyc.c(212): warning C4133: '=': incompatible types - from 'storeSessionID *' to 'storeSessionID *'
ifxpyc.c(392): warning C4047: '!=': 'SQLHANDLE' differs in levels of indirection from 'int'
ifxpyc.c(593): error C2065: 'gJoinSmartTrigger': undeclared identifier
ifxpyc.c(593): error C2224: left of '.callback' must have struct/union type
ifxpyc.c(594): error C2065: 'gJoinSmartTrigger': undeclared identifier
ifxpyc.c(594): error C2224: left of '.joinSessionID' must have struct/union type
ifxpyc.c(595): error C2065: 'gJoinSmartTrigger': undeclared identifier
ifxpyc.c(595): error C2224: left of '.ControlBackToApplication' must have struct/union type
ifxpyc.c(597): error C2065: 'gJoinSmartTrigger': undeclared identifier
ifxpyc.c(720): warning C4133: '=': incompatible types - from 'storeSessionID *' to 'storeSessionID *'
ifxpyc.c(833): error C2065: 'gopenSmartTrigger': undeclared identifier
ifxpyc.c(833): error C2224: left of '.isDetachable' must have struct/union type
ifxpyc.c(834): error C2065: 'gopenSmartTrigger': undeclared identifier
ifxpyc.c(834): error C2224: left of '.maxPendingOperations' must have struct/union type
ifxpyc.c(835): error C2065: 'gopenSmartTrigger': undeclared identifier
ifxpyc.c(835): error C2224: left of '.maxRecsPerRead' must have struct/union type
ifxpyc.c(836): error C2065: 'gopenSmartTrigger': undeclared identifier
ifxpyc.c(836): error C2224: left of '.timeOut' must have struct/union type
ifxpyc.c(838): error C2065: 'gopenSmartTrigger': undeclared identifier
ifxpyc.c(890): warning C4133: '=': incompatible types - from 'storeSessionID *' to 'storeSessionID *'
ifxpyc.c(1137): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1137): error C2109: subscript requires array or pointer type
ifxpyc.c(1140): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1140): error C2109: subscript requires array or pointer type
ifxpyc.c(1143): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1143): error C2109: subscript requires array or pointer type
ifxpyc.c(1146): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1146): error C2109: subscript requires array or pointer type
ifxpyc.c(1149): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1149): error C2109: subscript requires array or pointer type
ifxpyc.c(1152): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1152): error C2109: subscript requires array or pointer type
ifxpyc.c(1155): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1155): error C2109: subscript requires array or pointer type
ifxpyc.c(1158): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1158): error C2109: subscript requires array or pointer type
ifxpyc.c(1161): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1161): error C2109: subscript requires array or pointer type
ifxpyc.c(1164): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1164): error C2109: subscript requires array or pointer type
ifxpyc.c(1172): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1172): error C2109: subscript requires array or pointer type
ifxpyc.c(1173): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1173): error C2109: subscript requires array or pointer type
ifxpyc.c(1174): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1174): error C2109: subscript requires array or pointer type
ifxpyc.c(1175): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1175): error C2109: subscript requires array or pointer type
ifxpyc.c(1176): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1176): error C2109: subscript requires array or pointer type
ifxpyc.c(1177): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1177): error C2109: subscript requires array or pointer type
ifxpyc.c(1178): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1178): error C2109: subscript requires array or pointer type
ifxpyc.c(1179): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1179): error C2109: subscript requires array or pointer type
ifxpyc.c(1181): error C2065: 'gSmartTriggerRegister': undeclared identifier
ifxpyc.c(1181): error C2109: subscript requires array or pointer type
ifxpyc.c(1181): warning C4022: 'SQLSetStmtAttrW': pointer mismatch for actual parameter 3
ifxpyc.c(1181): error C2198: 'SQLSetStmtAttrW': too few arguments for call
ifxpyc.c(3036): warning C4133: '=': incompatible types - from 'storeSessionID *' to 'storeSessionID *'
ifxpyc.c(5698): warning C4996: 'PyUnicode_GetSize': deprecated in 3.3
ifxpyc.c(5926): warning C4244: 'function': conversion from 'SQLLEN' to 'SQLSMALLINT', possible loss of data
ifxpyc.c(5926): warning C4133: 'function': incompatible types - from 'SQLLEN *' to 'SQLINTEGER *'
ifxpyc.c(6068): warning C4996: 'PyUnicode_GetSize': deprecated in 3.3
ifxpyc.c(7404): warning C4244: 'function': conversion from 'SQLLEN' to 'long', possible loss of data
ifxpyc.c(7703): warning C4244: 'function': conversion from 'SQLLEN' to 'long', possible loss of data
ifxpyc.c(7978): warning C4244: 'function': conversion from 'SQLULEN' to 'long', possible loss of data
ifxpyc.c(8282): warning C4244: 'function': conversion from 'SQLLEN' to 'long', possible loss of data
ifxpyc.c(9262): warning C4133: 'function': incompatible types - from 'SQLWCHAR *' to 'const char *'
ifxpyc.c(11245): warning C4133: 'function': incompatible types - from 'SQLUINTEGER *' to 'SQLULEN *'
ifxpyc.c(11266): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
ifxpyc.c(11286): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
ifxpyc.c(11541): warning C4133: 'function': incompatible types - from 'SQLINTEGER *' to 'SQLLEN *'
ifxpyc.c(11711): warning C4244: 'function': conversion from 'SQLLEN' to 'long', possible loss of data
error: command 'c:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

OpenInformix Ifxpy driver building on Solaris

Dear All ,
We have successfully build the IfxPy driver on Redhat Linux platform and connected to the Informix db and done CRUD operations. But we were unable to find any IfxPy source files on Solaris platform . There is an urgent customer requirement to use python with Informix on Solaris.We would like to know more details about IfxPy driver on Solaris platform . (Whether it is being developed, and releasing date of the driver etc)

Thanks & Kind Regards
Indrajith (Cybersoft-SRILANKA)

Boolean values ​​return None

Hi everybody!

When I read columns of type Boolean T | F, I return None. Is there any configuration or parameter needed to read them correctly?

Thanks in advance

Closing the connection to non logged data base fails

Hi everyone,

I am new to IfxPy and Informix and have an issue or rather a question concerning using IfxPy with non logged databases. I was trying to connect using IfxPy to this non logged Informix database via an ODBC driver.

import IfxPyDbi as dbapi2

source_connection = dbapi2.connect(conn_string, "", "")
source_connection.close() 

Everything works fine until I want to close the connection again. Then I get this error:

File "path\lib\site-packages\IfxPyDbi.py", line 557, in close
    return_value = IfxPy.close(self.conn_handler)
Exception: [Informix][Informix ODBC Driver]Driver not capable. SQLCODE=-11092

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "extractor_main.py", line 23, in <module>
    Test_data_base_connection.test(dataload_configuration)
  File "some_other_path\test_connection.py", line 47, in test
    source_connection.conn.close()  # this is the same for postgres and informix
  File "path\lib\site-packages\IfxPyDbi.py", line 559, in close
    raise _get_exception(inst)
IfxPyDbi.Error: ifx_pydb::Error: [Informix][Informix ODBC Driver]Driver not capable. SQLCODE=-11092

This is probably to expect as the database has no transaction logging. I found this issue: #3 with the same problem. But the proposed workaround doesn't work for me. Probably because I am trying a different command.

Is there any possibility to properly close the connection to a non logged Informix database using IfxPy? Or is there a guide for how to deal with non logged data bases? Unfortunately, the admins of this database won't change the logging.

Thanks a lot!
Tom

How to bind binary data as a parameter

I tried several ways to get binary data into a column of type BLOB:

The following code leads to a Segmentation fault:

import IfxPy
conn = IfxPy.connect(...)
IfxPy.exec_immediate(conn, "drop table if exists t1")
IfxPy.exec_immediate(conn, "create table t1 (c1 blob)")
IfxPy.exec_immediate(conn, "insert into t1 (c1) values (?)", ("...",))

My second attempt:

import IfxPy
conn=IfxPy.connect(...)
IfxPy.exec_immediate(conn, "drop table if exists t1")
IfxPy.exec_immediate(conn, "create table t1 (c1 blob)")
stmt = IfxPy.prepare(conn, "insert into t1 (c1) values (?)")
param_type = IfxPy.PARAM_FILE
#param_type = IfxPy.SQL_PARAM_INPUT
rc = IfxPy.bind_param(stmt, 1, "/var/tmp/pic1.jpg", param_type, IfxPy.SQL_BINARY)
print rc
rc = IfxPy.execute(stmt)
print rc

This leads to:

True

Error: SQLBindFileToParam not supported yet
Binding a parameter marker in an SQL statement to a file reference will be a new featureTraceback (most recent call last):
 File "testBinary2.py", line 15, in <module>
   rc = IfxPy.execute(stmt)
Exception: Binding Error 3:

If I set param_type to IfxPy.SQL_PARAM_INPUT instead the result is:

True
Traceback (most recent call last):
  File "testBinary2.py", line 15, in <module>
    rc = IfxPy.execute(stmt)
Exception: Statement Execute Failed: [Informix][Informix ODBC Driver][Informix]Smart-large-object error. SQLCODE=-9810

Is there any supported way at the moment to bind binary data to a statement?

Where can I download Ifxpy for ARM64 platform

Hi,
I noticed the info below from readme:

The driver has support for both Python 2.7 and Python 3x. It has been certified across all major development platforms such as ARM64 running Raspbian OS, Linux, and Windows; and no surprise, it works well on the Raspberry Pi3.

My problem is: Where can I download IfxPy for ARM64 platform?
Thanks.

Python: [Informix][Informix ODBC Driver]Invalid string or buffer length. SQLCODE=-11071 when I fetch data

When I try to retreive my table in informix with ifxpy package, I get this error:

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-6-b0557e7f099b> in <module>
     16 while dictionary != False:
     17         tph.append(dictionary)
---> 18         dictionary = IfxPy.fetch_assoc(stmt)
     19 print(pd.DataFrame(tph))

Exception: [Informix][Informix ODBC Driver]Invalid string or buffer length. SQLCODE=-11071

This is my code:

import IfxPy
import pandas as pd
ConStr = "SERVER=informix1;DATABASE=ir_fmois;HOST=127.0.0.1;SERVICE=9092;UID=informix;PWD=1234;"
# netstat -a | findstr  9088
try:
    # netstat -a | findstr  9088
    conn = IfxPy.connect( ConStr, "", "")
except Exception as e:
    print ('ERROR: Connect failed')
    print ( e )
    quit()
sql = "SELECT * FROM oih"
stmt = IfxPy.exec_immediate(conn, sql)
dictionary = IfxPy.fetch_assoc(stmt)
tph=[]
while dictionary != False:
        tph.append(dictionary)
        dictionary = IfxPy.fetch_assoc(stmt)
print(pd.DataFrame(tph))

When I print the dataframe I see that I got only the first 4 rows.

I tried also this code and i doesn't trhow any exception but it returns also the first 4 rows of my table:

import IfxPyDbi as dbapi2
ConStr = "SERVER=informix1;DATABASE=ir_fmois;HOST=127.0.0.1;SERVICE=9092;UID=informix;PWD=1234;"
conn = dbapi2.connect( ConStr, "", "")
cur = conn.cursor()
sql = "SELECT * FROM oih"
rows = cur.fetchall()
len(rows)
>>>4

I tried importing columns one by one, and the same error has occured when I tried to select a byte (blob) column (with text data type). This column has emty values in the first 4 rows but the fifth wasn't empty, and I think this is why the error occured in line 5.

I would really appreciate if anyone has any idea on how to solve this.

CSDK/ODBC driver files aren't copied to site-packages on Arch Linux

Installing IfxPy on Arch Linux the CSDK/ODBC driver files aren't copied to site-packages. As far as I was able to track that down the path-generation for the extraction of the CSDK/ODBC driver archive goes "wrong". One piece of the path is retrieved via platform.processor() which calls uname -p which returns "unknown" at least on Arch Linux and Debian ...
Changing platform.processor() to platform.machine() in setup.py solves this issue for me - alternatively using py_cpuinfo could be worth considering ...

IfxPy-3.0.3-cp37-cp37m-win_amd64.whl not working

Hi Team,

I have installed IfxPy-3.0.3-cp37-cp37m-win_amd64.whl mentioned wheel in windows 64 bit python 7.3 but it not working as expected.

could you please update the .whl file and please publish wheels for all the python 3.6 version

Thanks in advance!!

SQLAlchemy dialect

I've been working on a sqlalchemy Informix dialect that will work with IfxPy. It's somewhat based on the old one that was included with sqlalchemy in previous versions. I have it functional with select queries and am working toward getting it passing sqlalchemy's tests. It may already work with all the other SQL statement types; I just haven't needed it for my use case.

Unfortunately, I'm not able to commit to supporting this dialect. It looks like OpenInformix would be a good home for it if you'd be willing to maintain the project since it's directly related to IfxPy. I'd be glad to participate in getting it off the ground.

What do you think?
Tim

Help running it in Windows with Python 3.8.5

Could you pleas help me to run it in windows?

  1. There is no pip install for the Ifxy
  • ERROR: Could not find a version that satisfies the requirement IfxPy (from versions: none)
  • `IfxPy> python -m pip install IfxPy
  • ERROR: No matching distribution found for IfxPy`

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?

Bad representation interval values in DataBase

I created a query in StackOverfolw about problems with Interval type data. (https://stackoverflow.com/questions/57474692/informix-interval-datatype-vs-python-timedelta-data-type?noredirect=1#comment101423358_57474692)

I have tested that the intelval types if created from python are stored in the Database in negative if they are positive and in positive if they are negative.

If the data is created from python this is not a problem but if the data is created from another client (JDBC, I4gl, dbaccess ...) when retrieved it is recovered erroneously.

I have tested it with the example of stackOverflow and with the test of the implementation of the interval type. (#5)

Thanks,

Django?

I see that Django is on the roadmap. How far along are you with thinking about a Django integration? I could potentially help, depending of course on how much work this would be and the feasibility of the implementation.

add macOS support

Cannot install ifxpy package from macOS High Sierra

$ pip install ifxpy
Collecting ifxpy
  Could not find a version that satisfies the requirement ifxpy (from versions: )
No matching distribution found for ifxpy

Error -23101 when trying to connect.

I'm getting this error when thrying to connect.

ERROR: Connect failed
[Informix][Informix ODBC Driver][Informix]Unspecified System Error = -23101. SQLCODE=-23101

Informix CSDK is installed at:
/opt/IBM/Informix_Client-SDK

My environment variables are like follows:
export LD_LIBRARY_PATH=/opt/IBM/Informix_Client-SDK/gls:/opt/IBM/Informix_Client-SDK/lib:/opt/IBM/Informix_Client-SDK/lib/esql:/opt/IBM/Informix_Client-SDK/lib/cli:/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH

I installed this CLISDK: ibm.csdk.4.50.FC2.LNX.tar.

My Python version is:
Python 3.7.4 64 bit

Also tried with:
Python 3.6.7 64 bit

Here's my little script:

import IfxPy

ConStr = "SERVER=[theserver];DATABASE=[somedb];HOST=[serverip];SERVICE=[theport];UID=[theuser];PWD=[thepassword];"

try:
conn = IfxPy.connect(ConStr, "clipcob", "t3st1ng")
except Exception as e:
print ('ERROR: Connect failed')
print (e)
quit()

How to setup isolation level?

info = IfxPy.server_info (conn)
info.DFT_ISOLATION is CS.
info.ISOLATION_OPTION is ('UR', 'CS', 'RR')

how to do change default isolation level to read uncommitted?

Connection timeout

I have a long time running SP call, the problem is that because it can take up to a couple of minutse, the connection gets lost somewhere in the middle.

I'm getting the following error saying that the transaction got aborted.
Fetch Failure: [Informix][Informix ODBC Driver][Informix]Long transaction aborted. SQLCODE=-458

Normally in other divers you can specify a timeout in the connection string so there won't be timeouts.

Is it possibly to do the same with IfxPy?

Don't deal Japanese.

I tried IfxPy.

Install is work fine.

But, don't coonect.

It is error message under.

Exception: [Informix][Informix ODBC Driver][Informix]Error opening required code-set conversion object file. SQLCODE=-23104

I tried to connect Informix to use perl on same enviroment.

Perl is work fine.

Mybe.. IfxPy don't deal Japanese.

Don't Open code-set conversion object file.

Don't have Code-set conversion object?

No, Informix ClientSDK have code-set conversion object file.

$ cat /opt/IBM/Informix_ClientSDK/etc/gls/cm3/registry | grep -e utf8 -e sjis-s -e cp932                   
# codesetname	 number	 codeset hex
  sjis-s          932     # 0x03a4
  cp932           932     # 0x03a4 Japanese MS Windows Code Page 932
  utf8            57372   # 0xe01c  
  • DB_LOCALE=sjis-s
  • CLIENT_LOCALE=utf8

So, Code-set Conversion Object file is 03a4e01c.csv and e01c03a4.csv.

I search it.

Please watch under.

Informix Client SDK have Codeset Conversion Object file.

vagrant@debian10:/opt/IBM/Informix_Client-SDK/gls/cv9$ ls -l {e01c03a4.cvo,03a4e01c.cvo}
 -rw-r--r-- 1 root root  81121  2月 16  2019 03a4e01c.cvo
 -rw-r--r-- 1 root root 159162  2月 16  2019 e01c03a4.cvo

vagrant@debian10:/opt/IBM/Informix_Client-SDK/gls/lc11/ja_jp$ ls -l
 合計 116
 -rw-r--r-- 1 root root  7768  2月 16  2019 03a4.lco #sjis-s
 -rw-r--r-- 1 root root 10179  2月 16  2019 e006.lco
 -rw-r--r-- 1 root root 11411  2月 16  2019 e007.lco
 -rw-r--r-- 1 root root 85267  2月 16  2019 e01c.lco #utf8

Environment

Client

  • vagrant box generic/debian10
  • Informix Client SDK 4.50FC1
  • CLIENT_LOCALE=ja_jp.utf8
$ localectl
System Locale: LANG=ja_JP.UTF-8
               LANGUAGE=ja_JP:ja
    VC Keymap: n/a
    X11 Layout: us
    X11 Model: pc105

Server

  • CentOS7
  • Informix Dynamic Server 12.10FCWE12
  • DB_LOCALE=ja_jp.sjis-s

Procedure

# make csdk folder
$ mkdir csdk
# extract
$ tar -xvf clientsdk.4.10.FC9DE.LINUX.tar -C csdk
$ cd csdk
# Install Library for installclientcsdk 
$ sudo apt -y install libaio1 bc libncurses5 ncurses-bin libpam0g
$ sudo apt -y install libncurses5-dev libelf1 

# Install
$ sudo ./installclientcsdk -i console

# SET Environment Variables
# export INFORMIXDIR=/opt/IBM/informix # CSDK 4.10 
export INFORMIXDIR=/opt/IBM/Informix_Client-SDK #CSDK 4.50
export LD_LIBRARY_PATH=${INFORMIXDIR}/lib:${INFORMIXDIR}/lib/esql:${INFORMIXDIR}/lib/cli

# Make sqlhosts
$ sudo cp /opt/IBM/Informix_Client-SDK/etc/sqlhosts.std /opt/IBM/Informix_Client-SDK/etc/sqlhosts
$ vi /opt/IBM/Informix_Client-SDK/etc/sqlhosts
# ...etc....
servername        onsoctcp        serverip      21435
$

# SET DB_LOCALE
$ export DB_LOCALE=ja_jp.sjis-s

# SET CLIENT_LOCALE
$ export DB_LOCALE=ja_jp.utf8

# pip install
$ sudo apt install python3-pip

# Install IfxPy
$ pip3 install IfxPy --user

# make python file
$ vi ifxcnnt.py

# Execute Python3
$ python3 ifxcnnt.py
  Traceback (most recent call last):
   File "ifxcnnt.py", line 6, in <module>
     conn=IfxPy.connect(ConStr,"","")
 Exception: [Informix][Informix ODBC Driver][Informix]Error opening required code-set conversion object file. SQLCODE=-23104

BigSerial none value

Hello,
I'm having a problem fetching some data from a column with type bigserial. It always returns None. This specific type is not supported? The same query returns me information with SQuirreL.

WhatsApp Image 2020-11-24 at 15 40 12

71527e94-0588-445e-acc6-aca7ad0587c7

92e9421e-b635-44a7-b806-9f9ac63c64a1

Thanks in advance

Chinese characters are not displayed properly

one database, use pyodbc is ok

file odbc.ini

[zdh]
Driver=/opt/IBM/informix/lib/cli/iclit09b.so
Description=IBM INFORMIX ODBC DRIVER
Database=dbname
LogonID=id
pwd=pwd
Servername=sop_tcp
CLIENT_LOCALE=en_US.819
DB_LOCALE=en_US.819
TRANSLATIONDLL=/opt/IBM/informix/lib/esql/igo4a304.so

code :

import pyodbc
class AAAA():
    def __init__(self, DSN):
        try:
            self.cnxn = pyodbc.connect('DSN=%s' % DSN, timeout=2)
            self.cnxn.setdecoding(sqltype=pyodbc.SQL_CHAR, encoding='utf8')
            self.cnxn.setdecoding(sqltype=pyodbc.SQL_WCHAR, encoding='utf8')
            if platform.system() != 'Windows':
                self.cnxn.setdecoding(sqltype=pyodbc.SQL_WMETADATA, encoding='utf-32le')
            self.cnxn.setencoding(encoding=ENC)
        except Exception as ex:
            logz.error('Error,Connect DB error:%s' % ex)
            self.cnxn = None

It's work fine ...

use this module:

ConStr = "SERVER=sop_tcp;PROTOCOL=onsoctcp;DATABASE=dbname;HOST=10.110.2.20;SERVICE=9088;UID=id;PWD=pwd;CLIENT_LOCALE=en_US.819;DB_LOCALE=en_US.819;"

some stmt, Chinese characters are not displayed properly

ImportError: DLL load failed while importing IfxPy: The specified module could not be found.

I successfully built windows pyd package.
There's out.txt (compile result) file uploaded.
I set INFORMIXDIR and I put INFORMIXDIR/bin in PATH:
C:\work\IfxPy\Examples>echo %INFORMIXDIR%
C:\Informix\icsdk450
C:\work\IfxPy\Examples>echo %PATH%
C:\Informix\icsdk450\bin;C:\Program Files (x86)\Micros.....

Then I copied IfxPy files to Python dir:
C:\work\IfxPy\Examples>copy c:\work\IfxPy\IfxPy\build\lib.win-amd64-3.8\IfxPy.cp38-win_amd64.pyd c:\Python38\Lib\site-packages
1 file(s) copied.

C:\work\IfxPy\Examples>copy c:\work\IfxPy\IfxPy\build\lib.win-amd64-3.8\IfxPyDbi.py c:\Python38\Lib\site-packages
1 file(s) copied.

C:\work\IfxPy\Examples>

Running Sample1.py produces an error:
C:\work\IfxPy\Examples>python Sample1.py
Traceback (most recent call last):
File "Sample1.py", line 3, in
import IfxPy
ImportError: DLL load failed while importing IfxPy: The specified module could not be found.

What do I miss?
out.txt

How to speed up the loop

Hello,

I'm using your snippet :

rc = 0
while dictionary != False:
    rc = rc + 1
    print ("--  Record {0} --".format(rc))
    dictionary = IfxPy.fetch_both(stmt)

It takes exactly 14 seconds to loop on 36137 items. And If I remove dictionary = IfxPy.fetch_both(stmt) the loop is over just after 2 seconds.

Do you have an idea to speed up the loop ? Or this is the best I can get ?

ImportError: DLL load failed while importing IfxPy: The specified module could not be found.

Is there a way how to debug this error message?
I read other similar issues and IMO I have set all I need.

I try to build/use with python3.8 and vs2019. I build it this way:

set INFORMIXDIR=c:\Program Files\IBM Informix Client SDK
SET PATH=%INFORMIXDIR%\bin;%PATH%
SET CSDK_HOME=%INFORMIXDIR%
SET MY_PY_DIR=f:/Developments/Python-3.8.4
SET VS90COMNTOOLS=%VS140COMNTOOLS%
"c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
python setup.py build
python setup.py install
Detected 64-bit Python
running install
running bdist_egg
running egg_info
writing IfxPy.egg-info\PKG-INFO
writing dependency_links to IfxPy.egg-info\dependency_links.txt
writing top-level names to IfxPy.egg-info\top_level.txt
reading manifest file 'IfxPy.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'IfxPy.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
creating build\bdist.win-amd64\egg
copying build\lib.win-amd64-3.8\IfxPy.cp38-win_amd64.pyd -> build\bdist.win-amd64\egg
copying build\lib.win-amd64-3.8\IfxPyDbi.py -> build\bdist.win-amd64\egg
byte-compiling build\bdist.win-amd64\egg\IfxPyDbi.py to IfxPyDbi.cpython-38.pyc
creating stub loader for IfxPy.cp38-win_amd64.pyd
byte-compiling build\bdist.win-amd64\egg\IfxPy.py to IfxPy.cpython-38.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying IfxPy.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying IfxPy.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying IfxPy.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying IfxPy.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
writing build\bdist.win-amd64\egg\EGG-INFO\native_libs.txt
zip_safe flag not set; analyzing archive contents...
__pycache__.IfxPy.cpython-38: module references __file__
creating 'dist\IfxPy-3.0.3-py3.8-win-amd64.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing IfxPy-3.0.3-py3.8-win-amd64.egg
creating c:\program files\python38\lib\site-packages\IfxPy-3.0.3-py3.8-win-amd64.egg
Extracting IfxPy-3.0.3-py3.8-win-amd64.egg to c:\program files\python38\lib\site-packages
Adding IfxPy 3.0.3 to easy-install.pth file

Installed c:\program files\python38\lib\site-packages\ifxpy-3.0.3-py3.8-win-amd64.egg
Processing dependencies for IfxPy==3.0.3
Finished processing dependencies for IfxPy==3.0.3

Then I run:

python tests\test_000_PrepareDb.py
Traceback (most recent call last):
  File "tests\test_000_PrepareDb.py", line 8, in <module>
    import IfxPy
ImportError: DLL load failed while importing IfxPy: The specified module could not be found.

[Informix][Informix ODBC Driver]Invalid string or buffer length. SQLCODE=-11071

I opened a new issue for my college:

"I looked into IfxPy/tests/test_045_FetchTupleBinaryData_01.py and there it looks like you could simply do an exec_immediate without explicit bind_param calls. I tried that with a column of type "byte" but I only get an Error:

Exception: Column binding cannot be done: [Informix][Informix ODBC Driver]Invalid string or buffer length. SQLCODE=-11071"

ImportError: DLL load failed: %1 is not a valid Win32 application.

I get the error ImportError: DLL load failed: %1 is not a valid Win32 application when i try to import IfxPy:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-77ef8b2ad358> in <module>
----> 1 import IfxPy

ImportError: DLL load failed: %1 is not a valid Win32 application.

informix Clinet-SDK vesrion: 4.10.TC9

PS: my server is running correctly, Ican connect to my database with RazorSQL fine with no problems

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.