informix.py 671 B

12345678910111213141516171819202122
  1. import IfxPy
  2. ConStr = "SERVER=gc-server6;DATABASE=csdb;HOST=192.168.2.46;SERVICE=9088;UID=informix;PWD=Gcbs12ma;"
  3. conn = IfxPy.connect(ConStr, "", "")
  4. sql = "SELECT cmid, objid FROM cmobjprops1 WHERE objid IN ('::Everyone', '::System Administrators') OR objid LIKE 'CognosEx:%'"
  5. stmt = IfxPy.exec_immediate(conn, sql)
  6. dictionary = IfxPy.fetch_both(stmt)
  7. rc = 0
  8. while dictionary != False:
  9. rc += 1
  10. print("-- Record {0} --".format(rc))
  11. print("c1 is : ", dictionary[0])
  12. print("c2 is : ", dictionary[1])
  13. print("c3 is : ", dictionary["c3"])
  14. print("c4 is : ", dictionary[3])
  15. print(" ")
  16. dictionary = IfxPy.fetch_both(stmt)
  17. IfxPy.close(conn)