cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
250
Views
10
Helpful
5
Replies
Beginner

Connection to CCX Database via Python

I'd like to pull out data from the CCX database with a Python library. AFAIK, the only way to do this is connecting via custom software (e.g., Python) to the CCX's Informix.

 

After installing the Informix Client SDK and pyodbc (a Python library for ODBC connection), 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)')

 

Googling around, it looks like there could be something wrong in the server parameter (i.e., the name of the informix server). Is there a way to check this value in the CCX?

 

However, apart from this approach, is there another way to use an external python software to pull data out from the CCX box? If I cannot fix this, I can use that alternative as a reasonable fallback.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Beginner

Re: Connection to CCX Database via Python

Turned out that the problem was related to the server name that was my_uccx_uccx instead of my-uccx_uccx. Server names should not include dashes.

 

Hope this can help someone else out there! : )

View solution in original post

5 REPLIES 5
Highlighted
Beginner

Re: Connection to CCX Database via Python

Turned out that the problem was related to the server name that was my_uccx_uccx instead of my-uccx_uccx. Server names should not include dashes.

 

Hope this can help someone else out there! : )

View solution in original post

Highlighted
VIP Advisor

Re: Connection to CCX Database via Python

Would you mind posting a working example of connecting and reading out some data for us?

Anthony Holloway
Highlighted
Beginner

Re: Connection to CCX Database via Python

Oh, ok, sure @Anthony Holloway! To make the things work fine, I built a docker container with the ODBC driver inside it (for Linux, in my case) but, if you prefer, you can also work inside a common OS environment (Windows, Linux, MacOS, ...). Of course, you need also python and pyodbc. Once you are up & running, you can just exploit pyodbc. Here is an example:

 

import pyodbc

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

conn.setdecoding(pyodbc.SQL_WCHAR, encoding='utf-8') conn.setencoding(str, encoding='utf-8') conn.setencoding(unicode, encoding='utf-8', ctype=pyodbc.SQL_CHAR) cursor = conn.cursor()
cursor.execute("select FIRST 10 * from dialinglisthistory")

# ...and there you go!
rows = cursor.fetchall()

 

Here you can find more details about it:

https://paultursan.com/2017/06/querying-cisco-unified-contact-center-express-uccx-historical-database-with-python-pyodbc-and-informix-odbc-driver/ 

 

Hope this helps!

Highlighted
VIP Advisor

Re: Connection to CCX Database via Python

Thank you!

Anthony Holloway
Highlighted
Beginner

Re: Connection to CCX Database via Python

You are welcome @Anthony Holloway 

 

Bye!

CreatePlease to create content