我希望有人能够阐明这个在非常过时的 Cisco Call manager 6.1 服务器(带有一台功能性 SUB 机器的 PUB 机器)上运行的相当古老的 informix DB 连接问题。无人值守断电后,无法再连接到数据库,但 Informix 数据库已启动并正在运行:
-sh-2.05b$ onstat -
IBM Informix Dynamic Server 版本 10.00.UC5XAG -- 上线 -- 更新 03:53:48 -- 196284 KB
jar 文件似乎一切正常(我还提取了它们以检查其完整性),包括 ifxjdc.jar 和 ifxsqlj.jar 文件,它们位于默认位置(/usr/local/cm/db/informix/jdbc/lib )。我还检查了 pref.XML 文件,看看是否有损坏的文件,但它们似乎都检查正常。一个简单的“dbl ping”命令(这会调用一个检查数据库名称的 jar 文件 -> java com.cisco.ccm.dbl.Ping $*)会输出错误:
-sh-2.05b$ sudo dbl ping
CCM1(EXCEPTION: Failed to get Connection.Connector(NOT CONNECTED: Driver=NO_JDBCDRIVER_PROVIDED;))
Error ['Error executing [source /usr/local/cm/db/dblenv.bash ; java com.cisco.ccm.dbl.Ping 2> /dev/null] returned [256]']
相关源环境文件正确:
-sh-2.05b$ 猫 /usr/local/cm/db/dblev.bash
PREFIX=/usr/local/cm
if [ "$1" != "" ]; then
PREFIX=$1
if [ ! -d "$PREFIX" ]; then
# Fix the directory to something reasonable
PREFIX=/usr/local/cm
fi
fi
if [ "$PREFIX" != "$LAST_DBLENV_PREFIX" ]; then
if [ -d "$PREFIX" ]; then
export LD_LIBRARY_PATH=$PREFIX/lib:$PREFIX/../thirdparty/java/j2sdk/jre/lib/i386:$LD_LIBRARY_PATH
export PATH=$PREFIX/bin:$PREFIX/../thirdparty/java/j2sdk/bin:$PATH
for J in $PREFIX/jar/*.jar; do
CLASSPATH=$J:$CLASSPATH
done
export CLASSPATH
export PYTHONPATH=$PREFIX/lib:$PYTHONPATH
if [ -f "$PREFIX/db/informix/local/ids.env" ]; then
source $PREFIX/db/informix/local/ids.env
fi
export LAST_DBLENV_PREFIX=$PREFIX
fi
ids.env 文件也完好无损:
-sh-2.05b$ cat db/informix/local/ids.env
export INFORMIXDIR=/usr/local/cm/db/informix
export INFORMIXTMP=/usr/local/cm/db/informix/tmp
export PATH=$INFORMIXDIR:$INFORMIXDIR/bin:$PATH
export LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib/cli:$LD_LIBRARY_PATH
export EDITOR=vi
export ODBCINI=/etc/odbc.ini
if [ "$1" == "l2" ] || [ "$1" == "L2" ]; then
# The migration/update case, use Side B
export ONCONFIG=onconfig.ccmb
export INFORMIXSERVER=ccm1_ccm6_1_4_2000_2
export INFORMIXOLDSERVER=ccm1_ccm6_1_2_1001_4
else
#The Normal Case
export ONCONFIG=onconfig.ccm
export INFORMIXSERVER=ccm1_ccm6_1_4_2000_2
fi
if [ -d $INFORMIXDIR/jdbc/lib ]; then
for J in $INFORMIXDIR/jdbc/lib/*.jar ; do
export CLASSPATH=$J:$CLASSPATH
done
fi
export FET_BUF_SIZE=32767
export OPTOFC=1
export IFX_LOCK_MODE_WAIT=30
export DB_LOCALE=en_us.utf8
export CLIENT_LOCALE=en_us.utf8
export SERVER_LOCALE=en_us.utf8
#export CDRFE_TRACE=1
#export SQLIDEBUG=2:/tmp/sqlidebug.out
此外,CLASSPATH 环境变量包含 jar 所在的所有目录。
我知道如果在定义/指定 Informix SQL 驱动程序之前调用数据库连接,则会生成此错误,但这在所有 jar 引用的 /usr/local/cm/conf/dbl/prefs.xml 文件中似乎也是正确的课程:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<map>
<entry key="numminutes" value="1440"/>
<entry key="enable" value="1"/>
<entry key="jdbcurl_super" value="jdbc:informix-sqli://CCM1:1500/None:informixserver=ccm1_ccm6_1_4_2000_2;user=informix;IFX_LOCK_MODE_WAIT=10"/>
<entry key="jdbcurl_car" value="jdbc:informix-sqli://CCM1:1500/car:informixserver=ccm1_ccm6_1_4_2000_2;user=dbcarsch;IFX_LOCK_MODE_WAIT=20"/>
<entry key="tracefile" value="/var/log/active/cm/trace/dbl/sdi/dbl.log"/>
<entry key="jdbcurl_power" value="jdbc:informix-sqli://CCM1:1500/None:informixserver=ccm1_ccm6_1_4_2000_2;user=database;IFX_LOCK_MODE_WAIT=10"/>
<entry key="jdbcurl" value="jdbc:informix-sqli://CCM1:1500/None:informixserver=ccm1_ccm6_1_4_2000_2;"/>
<entry key="tracelevel" value="127"/>
<entry key="outputdebugstringflag" value="0"/>
<entry key="jdbcurl2" value="jdbc:informix-sqli://CCM1:1500/None:informixserver=ccm1_ccm6_1_4_2000_2;"/>
<entry key="compressionenabled" value="0"/>
<entry key="numfiles" value="50"/>
<entry key="numlines" value="10000"/>
</map>
如果 informix-sqli jdbc 驱动程序定义正确,可能会导致错误的原因是什么?可能其他文件已损坏?
检查环境变量、jar、.env 定义文件、xml 文件是否有任何损坏。
这是 $CLASSPATH (我之前检查过,它确实包含对 jar 路径的所有引用 - 而且它与它的“孪生”或“SUB”机器相同,当前正在运行,但只读,因为它是一个集群)
CLASSPATH=/usr/local/cm/db/informix/jdbc/lib/ifxtools.jar:/usr/local/cm/db/informix/jdbc/lib/ifxsqlj.jar:/usr/local/cm/db/informix/jdbc/lib/ifxlsupp.jar:/usr/local/cm/db/informix/jdbc/lib/ifxlang.jar:/usr/local/cm/db/informix/jdbc/lib/ifxjdbcx.jar:/usr/local/cm/db/informix/jdbc/lib/ifxjdbc.jar:/usr/local/cm/jar/typetables.jar:/usr/local/cm/jar/taps.jar:/usr/local/cm/jar/risquery.jar:/usr/local/cm/jar/risbean.jar:/usr/local/cm/jar/reporter.jar:/usr/local/cm/jar/providerutil.jar:/usr/local/cm/jar/perfutil.jar:/usr/local/cm/jar/pd.jar:/usr/local/cm/jar/multipartrequest.jar:/usr/local/cm/jar/log4j-1.2.8.jar:/usr/local/cm/jar/licenseccm.jar:/usr/local/cm/jar/ldapsyncplugable.jar:/usr/local/cm/jar/ldapbp.jar:/usr/local/cm/jar/jtapi.jar:/usr/local/cm/jar/jsafe.jar:/usr/local/cm/jar/jprefs.jar:/usr/local/cm/jar/JPIWriter.jar:/usr/local/cm/jar/JavaNcsClient.jar:/usr/local/cm/jar/ipmamigrator.jar:/usr/local/cm/jar/IMS.jar:/usr/local/cm/jar/fscontext.jar:/usr/local/cm/jar/fappender.jar:/usr/local/cm/jar/emutil.jar:/usr/local/cm/jar/dnaServer.jar:/usr/local/cm/jar/dirsync.jar:/usr/local/cm/jar/dhcpMon.jar:/usr/local/cm/jar/dbl2j.jar:/usr/local/cm/jar/commons-logging.jar:/usr/local/cm/jar/cmutil.jar:/usr/local/cm/jar/cmplatform-realm.jar:/usr/local/cm/jar/cmdbutil.jar:/usr/local/cm/jar/cisco-platform-realm.jar:/usr/local/cm/jar/cisco-ccm-realm.jar:/usr/local/cm/jar/cdrdlv.jar:/usr/local/cm/jar/CCMScheduler.jar:/usr/local/cm/jar/ccm-realm.jar:/usr/local/cm/jar/CCMEncryption.jar:/usr/local/cm/jar/CCMAuthentication.jar:/usr/local/cm/jar/ccmadmin_common.jar:/usr/local/cm/jar/bps.jar:/usr/local/cm/jar/amc.jar:/usr/local/cm/jar/alarmutil.jar:/usr/local/cm/jar/ac.jar:
我发现 prefs.xml 文件配置错误。该文件是在每次服务(重新)启动时由启动脚本重新创建的,并且可能由于电源故障(我猜它一定是多次,我不能确定)该过程被强制中断。在随后的重新引导/重新启动时,它被错误地视为有效(如果存在,则引用它,如果丢失,则从其他环境变量重新创建)。添加正确的数据库名称(而不是 /None)和 jdbc 驱动程序定义并重新启动数据库服务和 Tomcat 后,数据库再次可访问。