Example #1
0
    def __init__(self):
        # set up coms link
        # todo: at the moment, if this fails it will try to use the default config. Sort that out
        try:
            self._config = figConfig.get_config("odbc")
            ISeriesComs._SYSTEM = self._config["system"]
            ISeriesComs._UID = self._config["username"]
            ISeriesComs._PWD = self._config["password"]

            self._config = figConfig.get_config("log")
            ISeriesComs._library = self._config["library"]
            ISeriesComs._file = self._config["file"]
        except IOError as e:
            # decide something sensible to happen here
            print "There was an error getting the iSeries sign on configuration"

        connection_string = 'DRIVER=' + ISeriesComs._DRIVER + ';SYSTEM=' + ISeriesComs._SYSTEM + ';UID=' + ISeriesComs._UID + ';PWD=' + ISeriesComs._PWD + ';DBQ=' + ISeriesComs._DBQ + ';EXTCOLINFO=' + ISeriesComs._EXTCOLINFO
        con = pyodbd.connect(connection_string)
        self.cur = con.cursor()