开发者

Problem in establishing DB2 connection in Java with wrong username/password

开发者 https://www.devze.com 2023-02-14 20:15 出处:网络
I have a problem in establishing DB2 connection with wrong user-name/password. We have an application which runs on LAN on many systems using DB2 database located on my system as well as other systems

I have a problem in establishing DB2 connection with wrong user-name/password. We have an application which runs on LAN on many systems using DB2 database located on my system as well as other systems.

Firstly I use this URL to create other system DB2 connection:

Connection con = DriverManager.getConnection("jdbc:db2://Rahulkcomputer:50000/XAN4", "rahulk", "dbirs#35");

this returns proper Connection object. Now 开发者_运维百科when I change the URL to access my system DB2 connection with same user-name/password as (using same user-name/password is intensely done for checking error handling):

Connection con = DriverManager.getConnection("jdbc:db2://127.0.0.1:50000/XAN4", "rahulk", "dbirs#35");

This time it again returns the Connection object instead of throwing an SQLException specifying wrong user-name/password (due to my system's DB2 authentication is totally different from Rahulkcomputer's system)

After getting connection, I execute this query to check proper user name as explained in post:

Simple DB2 Query for connection validation

SELECT CURRENT SQLID FROM SYSIBM.SYSDUMMY1

(this returns "rahulk" in both cases)

Why DB2 created connection in 2nd case with wrong user-name/password (moreover when we close all the services of DB2 on Rahulkcomputer, even then I get the connection in 2nd case)?

Thanks in Advance.


You either created your database with the restrictive option or revoked the select right to sysibm from PUBLIC. The connection you had was fine, the access rights not. 42704 is DB2's way of saying "huh?", it did not recognize sysibm because you had no rights to see it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号