连接DB2报错:ERRORCODE=-4499, SQLSTATE=08004

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/shuideyidi/article/details/75453197
前言:
    前几天用SQuirrel SQL Client (松鼠客户端)连接DB2报错,具体信息如下:
java.util.concurrent.ExecutionException: java.lang.RuntimeException: com.ibm.db2.jcc.a.pm: [jcc][t4][2057][11264][4.0.100] The application server rejected establishment of the connection.
An attempt was made to access a database,XXXDB , which was either not found or does not support transactions. ERRORCODE=-4499, SQLSTATE=08004
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:206)


思路:

    百度or谷歌错误代码:ERRORCODE=-4499, SQLSTATE=08004


过程:
    百度的结果...无力吐槽,每一个有用的。



    没办法,只能靠谷歌了,google的结果:


真TM的感动,第一个就是答案,附上link:https://www-304.ibm.com/support/docview.wss?uid=swg21443723
里面告诉我起因是:
Using DCS DB alias or local alias name of the database in the connection string will cause this error.


其实就是数据库的名字有点问题,可能是使用了别名照成的,需要去看看真实的名字。可以采用下面这个命令查看:
SELECT CURRENT SERVER FROM SYSIBM.SYSDUMMY1;
或者
db2 list db directory


先用putty直接访问数据库所在的linux服务器,然后切换用户,查寻所有数据库(DB2相关命令可以别人的博客,比如:http://blog.csdn.net/fuwencaho/article/details/20629567)
# su - db2inst1

$ db2 list db directory


 System Database Directory


 Number of entries in the directory = 5


Database 1 entry:


 Database alias                       = XXX_DB_1
 Database name                        = XXX_DB_1
 Local database directory             = /home/db2inst1
 Database release level               = 10.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =
.....


我以前错误的URL是:jdbc:db2://1.1.1.1:50000/XXXDB
根据上面搜出的结果,正确的应该是:jdbc:db2://1.1.1.1:50000/XXX_DB_1.


猜你喜欢

转载自blog.csdn.net/shuideyidi/article/details/75453197