I'm running Ubunutu 20.04 LTs on a server and have the following for my Python code. IfxPy is installed correctly and if I modify the sql statement to change the table name the program will run, however if I change after the WHERE criteria, the system simply returns "0" & "Done"
import IfxPy
ConStr="Driver={IBM INFORMIX ODBC DRIVER};SERVER=db;DATABASE=records;host=myhost;service=9088;protocol=onsoctcp"
conn=IfxPy.connect(ConStr,"Username","Password")
sql = "SELECT * FROM public.daylog WHERE sernum < 40"
stmt = IfxPy.exec_immediate(conn,sql)
tu = IfxPy.fetch_assoc(stmt)
#print(tu)
rc = 0
str = []
while tu != False:
rc += 1
print(tu)
tu = IfxPy.fetch_assoc(stmt)
print(rc)
IfxPy.free_result(stmt)
IfxPy.free_stmt(stmt)
IfxPy.close(conn)
print("Done")
If I run it the first time it will return the dictionary that I am looking for to get my program running, however if change the sql statement to be:
SELECT * FROM public.daylog WHERE sernum > 60"
I get nothing back from this. I have an ODBC connection to the database as well so I've tried testing it that way and seeing the data on the backend. I made sure to include the IfxPy.free_result and IfxPy.free_stmt functions.