使用IfxPy连接Avaya CMS Informix数据库时用户ID带主机名报错
I’ve run into similar connection headaches with Avaya CMS’s Informix backend before, so here are some targeted fixes and troubleshooting steps to try out:
1. Adjust Connection String User Identifier
The HCL ONEDB ODBC Driver has a known quirk where it automatically appends the client hostname to the username. Try these quick tweaks:
- Replace
UID=myuserwithUSER=myuserin your connection string—some Informix drivers prioritize theUSERparameter overUIDand skip adding the hostname suffix. - Wrap the username in single quotes:
UID='myuser'—this forces the driver to treat the username as a literal instead of modifying it.
2. Switch to IBM Informix Client SDK (Your Proposed Fix, With Practical Details)
HCL’s ONEDB driver doesn’t always play nicely with Avaya’s customized Informix setup. Here’s how to make the switch smoothly:
- Uninstall the current HCL ONEDB ODBC Driver and IfxPy completely to avoid conflicts.
- Install the correct bit-version of IBM Informix Client SDK: Most Avaya CMS deployments use 32-bit Informix even on 64-bit Windows, so go for the 32-bit SDK unless you’ve confirmed your CMS uses 64-bit.
- Reinstall IfxPy matching the SDK’s bitness (e.g., run
pip install IfxPy --platform win32if you installed the 32-bit SDK). - Configure
INFORMIXDIRto point to the SDK’s install path (likeC:\Program Files (x86)\IBM\Informix Client SDK), then set up an ODBC DSN using the IBM Informix ODBC Driver (not HCL’s) to test connectivity first. If the ODBC test works with justmyuseras the username, your Python connection should follow suit.
3. Verify Server-Side User & Configuration
Even with permissions granted, double-check these settings with your Avaya team:
- Confirm the
sysuserstable in thecmsdatabase contains the usermyuser(without the@myserversuffix). Informix won’t recognize the suffixed username if the account was created without it. - Ensure the
sqlhostsfile on the Informix server has the correct entry forcms_net:cms_net olsoctcp 10.10.10.10 50001 - Ask the team to check if the server’s authentication mode allows non-suffixed logins—Avaya CMS sometimes restricts this, so they may need to adjust
AUTHENTICATIONsettings in theonconfigfile.
4. Try Alternative Connection Syntax in Python
Instead of using a single connection string, pass parameters as a dictionary to IfxPy.connect()—this avoids potential parsing issues in the driver:
import os if 'INFORMIXDIR' in os.environ: os.add_dll_directory(os.path.join(os.environ['INFORMIXDIR'], "bin")) import IfxPy conn_params = { "SERVER": "cms_net", "HOST": "10.10.10.10", "SERVICE": "50001", "PROTOCOL": "olsoctcp", "CLIENT_LOCALE": "en_US.UTF8" } conn = IfxPy.connect("cms", "myuser", "mypassw", conn_params) IfxPy.close(conn)
Bonus Troubleshooting Step
Test connectivity directly via ODBC first to isolate the issue:
- Open the correct ODBC Data Source Administrator: Use
C:\Windows\System32\odbcad32.exefor 64-bit drivers,C:\Windows\SysWOW64\odbcad32.exefor 32-bit. - Create a System DSN pointing to your CMS Informix server, use
myuseras the username, and test the connection.- If the ODBC test fails with the same
-951error, the problem is with driver/server configuration, not Python. - If the ODBC test succeeds, the issue lies in how IfxPy is interacting with the driver—stick with the IBM SDK and alternative connection syntax.
- If the ODBC test fails with the same
内容的提问来源于stack exchange,提问作者bracko

