Welcome 微信登录

首页 / 数据库 / MySQL / Linux下DB2SQL1024N A database connection does not exist. SQLS

前几天在RedHat Linux 6安装了DB2V10.5,安装过程没报任何错误,但是在后来测试的时候发现一个问题如下:[db2inst@myrac1 ~]$ db2 connect to sldd user db2inst using db2instDatabase Connection InformationDatabase server        = DB2/LINUX 10.5.2SQL authorization ID = DB2INSTLocal database alias = SLDD[db2inst@myrac1 ~]$db2 list tablesSQL1024N A database connection does not exist. SQLSTATE=08003[db2inst@myrac1 ~]$db2 get connection state全是--,没有连接信息比较奇怪的是在CLP下么有问题[db2inst@myrac1 ~]$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 10.5.2You can issue database manager commands and SQL statements from the command
prompt. For example:
    db2 => connect to sample
    db2 => bind sample.bndFor general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.To exit db2 interactive mode, type QUIT at the command prompt. Outside
interactive mode, all commands must be prefixed with "db2".
To list the current command option settings, type LIST COMMAND OPTIONS.For more detailed help, refer to the Online Reference Manual.db2 => connect to sldd user db2inst using db2inst Database Connection Information Database server        = DB2/LINUX 10.5.2
 SQL authorization ID = DB2INST
 Local database alias = SLDDdb2 => list tablesTable/View                      Schema          Type  Creation time           
------------------------------- --------------- ----- --------------------------
ADVISE_INDEX                    DB2INST       T   2014-02-11-00.30.51.141096
ADVISE_INSTANCE               DB2INST       T   2014-02-11-00.30.50.725861
ADVISE_MQT                      DB2INST       T   2014-02-11-00.30.53.438431
ADVISE_PARTITION                DB2INST       T   2014-02-11-00.30.54.567669
ADVISE_TABLE                    DB2INST       T   2014-02-11-00.30.55.366786
ADVISE_WORKLOAD               DB2INST       T   2014-02-11-00.30.52.033549
DX_AJ_IND_STD                 DB2INST       T   2014-02-11-00.30.25.714475问题考虑:1.是不是因为实例用户是db2inst用户而不是db2inst1呢?经查证不是这个原因,虽然DB2的默认实例用户是db2inst1,但是可以创建其他的实例用户2.DB2COMM=TCPIP的原因?设置db2set DB2COMM=TCPIP,问题依旧最后,在网上找到了解决方案:[root@myrac1 ~]# vi /etc/services添加如下两行DB2_db2inst   60006/tcpDB2_db2inst_1 60007/tcpDB2_db2inst_2 60008/tcpDB2_db2inst_3 60009/tcpDB2_db2inst_4 60010/tcpDB2_db2inst_END 60011/tcpDB2_db2inst1    60012/tcpdb2c_db2inst 50005/tcp  db2inst实例监听端口db2i_db2inst 50009/tcp  db2inst实例中断端口DB2_db2inst1_1  60013/tcpDB2_db2inst1_2  60014/tcpDB2_db2inst1_3  60015/tcp[db2inst@myrac1 ~]$ db2 connect to sldd user db2inst using db2inst  Database Connection Information  Database server        = DB2/LINUX 10.5.2 SQL authorization ID = DB2INST Local database alias = SLDD[db2inst@myrac1 ~]$ db2 list tablesTable/View                      Schema          Type  Creation time            ------------------------------- --------------- ----- --------------------------ADVISE_INDEX                    DB2INST       T   2014-02-11-00.30.51.141096ADVISE_INSTANCE               DB2INST       T   2014-02-11-00.30.50.725861ADVISE_MQT                      DB2INST       T   2014-02-11-00.30.53.438431ADVISE_PARTITION                DB2INST       T   2014-02-11-00.30.54.567669本文永久更新链接地址