calvinkrishy
calvinkrishy

Reputation: 3928

SQLCODE -1829 on connect using informixdb

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.

Upvotes: 1

Views: 2032

Answers (1)

calvinkrishy
calvinkrishy

Reputation: 3928

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')

Upvotes: 1

Related Questions