Connection to the UCCX Database (Informix) via Python

Question:

I’d like to pull out data from the Cisco UCCX database (Informix) with a Python script.

After installing the Informix Client SDK and pyodbc as described in this guide, I run the following connection:

pyodbc.connect('SERVICE=1504;PROTOCOL=onsoctcp;CLIENT_LOCALE=en_US.UTF8;DB_LOCALE=en_US.UTF8;DRIVER={IBM INFORMIX ODBC DRIVER (64-bit)};UID=uccxhruser;PWD=my_pwd;DATABASE=db_cra;HOST=my-uccx;SERVER=my-uccx_uccx')

But I get the following error:

Error: (‘HY000’, ‘[HY000] [Informix][Informix ODBC
Driver][Informix]INFORMIXSERVER does not match either DBSERVERNAME or
DBSERVERALIASES. (-761) (SQLDriverConnect)’)

How can I fix this?

Asked By: floatingpurr

||

Answers:

Converting comments into an answer.

On the face of it, you’ve set the environment variable $INFORMIXSERVER (or specified its value in the connection string) to an incorrect value. Server names should not include dashes, so it might be that SERVER=my-uccx_uccx in the connection string is faulty, or it may be somewhere else. I’d hazard a guess that your server is my_uccx_uccx (an underscore instead of a dash) instead — but that’s a guess. Knowing what is specified for the actual server will be crucial.

Does the variable INFORMIXSERVER correspond to the SERVER param in the connection string?

That is information I don’t have — there’s a decent chance that SERVER in the connection string matches INFORMIXSERVER as an environment variable, but I don’t know for sure.

Given the later success, it is probable that SERVER in the connection string corresponds to INFORMIXSERVER in the environment.

Whooooaaaa! Turned out that the server name was my_uccx_uccx instead of my-uccx_uccx and now it works.

Great — I’m glad you’re up and running.

Answered By: Jonathan Leffler
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.