cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
365
Views
5
Helpful
2
Replies
Highlighted

Query Cisco Unity Databases from Linux.

Good morning Developer friends!!

 

Here is a newbie for DevNet, I respect your work very much and I hope I can be a qualified Cisco Developer.

Right now I am working into Collaboration Stuff.

 

Could you please help me with something?

 

Right now I am using Cisco Unity Connection Tools to query a database in unity connection.

in the query builder (GUI) I am putting this.

 

select count(*) from tbl_notifyq

to get the count,

but I would like to do this automatically in several clusters using a Linux computer.

 

 

Which would be the best way to accomplish the task,?

Note: you don;t have to be very specific, I know "Google is your best fried", but I hope you can give me some over-simplified instructions like.

 

Get this,

download this

use this

be happy!

 

What do you think?

Thank you very much for your time, and have a nice day.

 

 

 

Everyone's tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Cisco Employee

Re: Query Cisco Unity Databases from Linux.

I got the below working on Ubuntu 19.10 using the Python IfxPy library:

 

 

import IfxPy

connStr = 'CLIENT_LOCALE=en_US.57372;DB_LOCALE=en_US.57372;SERVER=ciscounity;DATABASE=unitydyndb;uid=Administrator;pwd=password'
conn = IfxPy.connect(connStr, '', '')

sql = 'select count(*) from tbl_notifyq'
stmt = IfxPy.exec_immediate(conn, sql)
dictionary = IfxPy.fetch_assoc(stmt)

print('tbl_notifyq: ',  dictionary[''])
 
IfxPy.free_result(stmt)
IfxPy.free_stmt(stmt)

IfxPy.close(conn)

 

 

- Download Informix SDK: https://www.ibm.com/products/informix/developer-tools?mhsrc=ibmsearch_a&mhq=informix
- Install SDK:

- On Ubuntu 19.10 I had to install libncurses5: sudo apt install libncurses5
- I selected the ODBC Driver, Common Database Utilities and Global Language Support (GLS) only
- I installed to /home/dstaudt/opt/IBM/Informix_Client-SDK (hereafter $INFORMIXDIR)
- Create sqlhosts file in $INFORMIXDIR/etc (important to use 'ciscounity' as the dbservername:)

#dbservername nettype hostname servicename options
ciscounity onsoctcp ds-cuc115.cisco.com 20532

- Install IfxPy: pip3 install ifxpy
- Project homepage: https://github.com/OpenInformix/IfxPy
- Setup your environment so that the following variables are active when the Python script runs (in VS Code I used launch.json):

LD_LIBRARY_PATH: /home/dstaudt/opt/IBM/Informix_Client-SDK/lib:/home/dstaudt/opt/IBM/Informix_Client-SDK/lib/esql:/home/dstaudt/opt/IBM/Informix_Client-SDK/lib/cli
INFORMIXDIR: /home/dstaudt/opt/IBM/Informix_Client-SDK

- I was stuck for a long time trying to get client/DB locales correct (weird locale used: en_US.57372 apparently: utf-8). Eventually I used the dbaccess tool (part of the SDK installed above), which might come in handy for CLI access to the database: https://www.ibm.com/support/pages/how-run-informix-sql-commands-your-rational-synergy-database-unix-or-linux-environment
- The key IfxPy sample that showed how to use the locale options: https://github.com/OpenInformix/IfxPy/blob/58edef9321979b82df177f7ba2e9c49bc71544eb/Examples/Sample1.ipynb
- Key info on how to determine the locale of a database: https://www.ibm.com/support/pages/how-fix-error-message-sql1822-informix-error-code-23197
- Info on how to enable necessary roles (System Administrator/Remote Access) and services for the Unity Connection database proxy: http://www.ciscounitytools.com/Applications/CxN/MessageHunter/Help/MessageHunter.htm#_Toc504638754
- Some info re Unity and Informix ODBC: https://ciscounitytools.com/Applications/CxN/InformixODBC/InformixODBC.html
- Cisco Unity Tools: https://ciscounitytools.com/index.html
-IfxPy usage examples: https://github.com/OpenInformix/IfxPy

 

Full VS Code project attached

View solution in original post

2 REPLIES 2
Highlighted
Cisco Employee

Re: Query Cisco Unity Databases from Linux.

I got the below working on Ubuntu 19.10 using the Python IfxPy library:

 

 

import IfxPy

connStr = 'CLIENT_LOCALE=en_US.57372;DB_LOCALE=en_US.57372;SERVER=ciscounity;DATABASE=unitydyndb;uid=Administrator;pwd=password'
conn = IfxPy.connect(connStr, '', '')

sql = 'select count(*) from tbl_notifyq'
stmt = IfxPy.exec_immediate(conn, sql)
dictionary = IfxPy.fetch_assoc(stmt)

print('tbl_notifyq: ',  dictionary[''])
 
IfxPy.free_result(stmt)
IfxPy.free_stmt(stmt)

IfxPy.close(conn)

 

 

- Download Informix SDK: https://www.ibm.com/products/informix/developer-tools?mhsrc=ibmsearch_a&mhq=informix
- Install SDK:

- On Ubuntu 19.10 I had to install libncurses5: sudo apt install libncurses5
- I selected the ODBC Driver, Common Database Utilities and Global Language Support (GLS) only
- I installed to /home/dstaudt/opt/IBM/Informix_Client-SDK (hereafter $INFORMIXDIR)
- Create sqlhosts file in $INFORMIXDIR/etc (important to use 'ciscounity' as the dbservername:)

#dbservername nettype hostname servicename options
ciscounity onsoctcp ds-cuc115.cisco.com 20532

- Install IfxPy: pip3 install ifxpy
- Project homepage: https://github.com/OpenInformix/IfxPy
- Setup your environment so that the following variables are active when the Python script runs (in VS Code I used launch.json):

LD_LIBRARY_PATH: /home/dstaudt/opt/IBM/Informix_Client-SDK/lib:/home/dstaudt/opt/IBM/Informix_Client-SDK/lib/esql:/home/dstaudt/opt/IBM/Informix_Client-SDK/lib/cli
INFORMIXDIR: /home/dstaudt/opt/IBM/Informix_Client-SDK

- I was stuck for a long time trying to get client/DB locales correct (weird locale used: en_US.57372 apparently: utf-8). Eventually I used the dbaccess tool (part of the SDK installed above), which might come in handy for CLI access to the database: https://www.ibm.com/support/pages/how-run-informix-sql-commands-your-rational-synergy-database-unix-or-linux-environment
- The key IfxPy sample that showed how to use the locale options: https://github.com/OpenInformix/IfxPy/blob/58edef9321979b82df177f7ba2e9c49bc71544eb/Examples/Sample1.ipynb
- Key info on how to determine the locale of a database: https://www.ibm.com/support/pages/how-fix-error-message-sql1822-informix-error-code-23197
- Info on how to enable necessary roles (System Administrator/Remote Access) and services for the Unity Connection database proxy: http://www.ciscounitytools.com/Applications/CxN/MessageHunter/Help/MessageHunter.htm#_Toc504638754
- Some info re Unity and Informix ODBC: https://ciscounitytools.com/Applications/CxN/InformixODBC/InformixODBC.html
- Cisco Unity Tools: https://ciscounitytools.com/index.html
-IfxPy usage examples: https://github.com/OpenInformix/IfxPy

 

Full VS Code project attached

View solution in original post

Highlighted

Re: Query Cisco Unity Databases from Linux.

Thank you!

5 Stars!

 

Juan

This widget could not be displayed.