views:

211

answers:

1

While trying to connect to the database I get a strange error:

DatabaseError: SQLCODE -1829 in CONNECT:
ì¦à : Cannot open file 'os.iem'
ì¦à : Cannot open file 'os.iem'

I can confirm that the file is present in $INFORMIXDIR/msg/en_us/0333/ directory. The environment variables INFORMIXDIR, INFORMIXSERVER and ONCONFIG are set correctly and as expected by my instance. Any clues on what I might be doing wrong?

Am connecting using informixdb (version 2.5) and am connecting to Informix version 11.5. The user who is connecting has the requisite permissions.

+1  A: 

ok figured this one out! It appears only the env values set before the import of the informixdb module affect the way the module works. So the following does not work:

import informixdb
os.environ["INFORMIXDIR"] = "/opt/informix"

...
def conn(db):
    informixdb.connect(db, self.username, self.passwd)
...
conn('local')

whereas the following does:

os.environ["INFORMIXDIR"] = "/opt/informix"
import informixdb

...
def conn(db):
    informixdb.connect(db, self.username, self.passwd)
...
conn('local')
calvinkrishy
Well done. I expected it to be 'environment', but didn't want to pontificate before I knew what I was dealing with.
Jonathan Leffler