def run_test_197(self):
    conn = ibm_db.connect(config.database, config.user, config.password)
    server = ibm_db.server_info( conn )

    if conn:
      try:
          rc = ibm_db.exec_immediate(conn, "DROP TABLE index_test")
      except:
          pass
      rc = ibm_db.exec_immediate(conn, "CREATE TABLE index_test (id INTEGER, data VARCHAR(50))")
      rc = ibm_db.exec_immediate(conn, "CREATE UNIQUE INDEX index1 ON index_test (id)")

      print "Test first index table:"
      if (server.DBMS_NAME[0:3] == 'IDS'):
        result = ibm_db.statistics(conn,None,config.user,"index_test",True)
      else:
        result = ibm_db.statistics(conn,None,None,"INDEX_TEST",True)
        
      row = ibm_db.fetch_tuple(result)
      ## skipping table info row. statistics returns informtation about table itself for informix ###
      if (server.DBMS_NAME[0:3] == 'IDS'):
        row = ibm_db.fetch_tuple(result)
      print row[2]  # TABLE_NAME
      print row[3]  # NON_UNIQUE
      print row[5]  # INDEX_NAME
      print row[8]  # COLUMN_NAME

      try:
          rc = ibm_db.exec_immediate(conn, "DROP TABLE index_test2")
      except:
          pass
      rc = ibm_db.exec_immediate(conn, "CREATE TABLE index_test2 (id INTEGER, data VARCHAR(50))")
      rc = ibm_db.exec_immediate(conn, "CREATE INDEX index2 ON index_test2 (data)")

      print "Test second index table:"
      if (server.DBMS_NAME[0:3] == 'IDS'):
        result = ibm_db.statistics(conn,None,config.user,"index_test2",True)
      else:
        result = ibm_db.statistics(conn,None,None,"INDEX_TEST2",True)
      row = ibm_db.fetch_tuple(result)
      ### skipping table info row. statistics returns informtation about table itself for informix ###
      if (server.DBMS_NAME[0:3] == 'IDS'):
        row = ibm_db.fetch_tuple(result)
      print row[2]  # TABLE_NAME
      print row[3]  # NON_UNIQUE
      print row[5]  # INDEX_NAME
      print row[8]  # COLUMN_NAME

      print "Test non-existent table:"
      if (server.DBMS_NAME[0:3] == 'IDS'):
        result = ibm_db.statistics(conn,None,config.user,"non_existent_table",True)
      else:
        result = ibm_db.statistics(conn,None,None,"NON_EXISTENT_TABLE",True)
      row = ibm_db.fetch_tuple(result)
      if row:
        print "Non-Empty"
      else:
        print "Empty"
    else:
      print 'no connection: ' + ibm_db.conn_errormsg()
    def run_test_197(self):
        conn = ibm_db.connect(config.database, config.user, config.password)
        server = ibm_db.server_info( conn )

        if conn:
            try:
                rc = ibm_db.exec_immediate(conn, "DROP TABLE index_test")
            except:
                pass
            rc = ibm_db.exec_immediate(conn, "CREATE TABLE index_test (id INTEGER, data VARCHAR(50))")
            rc = ibm_db.exec_immediate(conn, "CREATE UNIQUE INDEX index1 ON index_test (id)")

            print("Test first index table:")
            if (server.DBMS_NAME[0:3] == 'IDS'):
                result = ibm_db.statistics(conn,None,config.user,"index_test",True)
            else:
                result = ibm_db.statistics(conn,None,None,"INDEX_TEST",True)
            row = ibm_db.fetch_tuple(result)
            ## skipping table info row. statistics returns informtation about table itself for informix ###
            if (server.DBMS_NAME[0:3] == 'IDS'):
                row = ibm_db.fetch_tuple(result)
            print(row[2])  # TABLE_NAME
            print(row[3])  # NON_UNIQUE
            print(row[5])  # INDEX_NAME
            print(row[8])  # COLUMN_NAME

            try:
                rc = ibm_db.exec_immediate(conn, "DROP TABLE index_test2")
            except:
                pass
            rc = ibm_db.exec_immediate(conn, "CREATE TABLE index_test2 (id INTEGER, data VARCHAR(50))")
            rc = ibm_db.exec_immediate(conn, "CREATE INDEX index2 ON index_test2 (data)")

            print("Test second index table:")
            if (server.DBMS_NAME[0:3] == 'IDS'):
                result = ibm_db.statistics(conn,None,config.user,"index_test2",True)
            else:
                result = ibm_db.statistics(conn,None,None,"INDEX_TEST2",True)
            row = ibm_db.fetch_tuple(result)
            ### skipping table info row. statistics returns informtation about table itself for informix ###
            if (server.DBMS_NAME[0:3] == 'IDS'):
                row = ibm_db.fetch_tuple(result)
            print(row[2])  # TABLE_NAME
            print(row[3])  # NON_UNIQUE
            print(row[5])  # INDEX_NAME
            print(row[8])  # COLUMN_NAME

            print("Test non-existent table:")
            if (server.DBMS_NAME[0:3] == 'IDS'):
                result = ibm_db.statistics(conn,None,config.user,"non_existent_table",True)
            else:
                result = ibm_db.statistics(conn,None,None,"NON_EXISTENT_TABLE",True)
            row = ibm_db.fetch_tuple(result)
            if row:
                print("Non-Empty")
            else:
                print("Empty")
        else:
            print('no connection: ' + ibm_db.conn_errormsg())
# Create An Instance Of The Db2ConnectionMgr Class And Use It To Connect To A Db2 Database
conn = Db2ConnectionMgr('DB', dbName, '', '', userID, passWord)
conn.openConnection()
if conn.returnCode is True:
    dbConnection = conn.connectionID
else:
    conn.closeConnection()
    exit(-1)

# Attempt To Retrieve Information About The Indexes And Statistics That Exist For A
# Specified Table
print("Obtaining statistics for the " + schemaName + ".", end="")
print(tableName + " table ... ", end="")
try:
    resultSet = ibm_db.statistics(dbConnection, None, schemaName, tableName,
                                  True)
except Exception:
    pass

# If The Information Desired Could Not Be Retrieved, Display An Error Message And Exit
if resultSet is False:
    print("\nERROR: Unable to obtain the information desired\n.")
    conn.closeConnection()
    exit(-1)

# Otherwise, Complete The Status Message
else:
    print("Done!\n")

# As Long As There Are Records (That Were Produced By The ibm_db.statistics API), ...
noData = False