If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Problem in establishing DB2 connection in Java with wrong username/password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-03-11, 05:56
kishore_74_lko kishore_74_lko is offline
Registered User
 
Join Date: Mar 2011
Posts: 4
Cool Problem in establishing DB2 connection in Java with wrong username/password

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

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

Code:
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):

Code:
 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:
Code:
SELECT CURRENT SQLID FROM SYSIBM.SYSDUMMY1
(this returns "rahulk" in both cases)

sql - Simple DB2 Query for connection validation - Stack Overflow

please help me out of this problem. 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.

Kishore
Reply With Quote
  #2 (permalink)  
Old 03-04-11, 02:01
kishore_74_lko kishore_74_lko is offline
Registered User
 
Join Date: Mar 2011
Posts: 4
Have I posted under wrong Tags due to not getting any leads??
Please specify.
Reply With Quote
  #3 (permalink)  
Old 03-04-11, 03:51
singhipst singhipst is offline
Registered User
 
Join Date: Jul 2006
Location: Bangalore
Posts: 57
Check in your host file what is the entry for Rahulkcomputer or get the ip address of this machine.
Is Rahulkcomputer your local machine?
do you have rahulk account in your local machine?
__________________
Ritesh Kumar Singh
IBM Certified DB2 DBA for LUW
**Knowledge Is Theft If Not Shared !!**

Last edited by singhipst; 03-04-11 at 04:01.
Reply With Quote
  #4 (permalink)  
Old 03-06-11, 23:59
kishore_74_lko kishore_74_lko is offline
Registered User
 
Join Date: Mar 2011
Posts: 4
I checked my host file but there is only 1 entries:

Code:
127.0.0.1       localhost
But off-course RahulComputer in another computer in my LAN.
Reply With Quote
  #5 (permalink)  
Old 03-07-11, 00:07
singhipst singhipst is offline
Registered User
 
Join Date: Jul 2006
Location: Bangalore
Posts: 57
in your second case you are trying to connect to your local machine not the Rahulkcomputer

Connection con = DriverManager.getConnection("jdbc:db2://127.0.0.1:50000/XAN4", "rahulk", "dbirs#35");
__________________
Ritesh Kumar Singh
IBM Certified DB2 DBA for LUW
**Knowledge Is Theft If Not Shared !!**
Reply With Quote
  #6 (permalink)  
Old 03-07-11, 02:22
kishore_74_lko kishore_74_lko is offline
Registered User
 
Join Date: Mar 2011
Posts: 4
Talking Problem in stablishing DB2 connection in Java with wrong username/password

Dear Ritesh,

Exactly this is problem as I told in my post that, why connection is being created with rahul's DB2 user/password when I specifying 127.0.0.1 in connection URL?

In this case SQL Exception should be thrown due to giving wrong user/password.


Please give appropriate hint/answer.
Reply With Quote
  #7 (permalink)  
Old 07-19-11, 00:37
singhipst singhipst is offline
Registered User
 
Join Date: Jul 2006
Location: Bangalore
Posts: 57
Check your authentication parameters in DBM cfg

Code:
Database manager authentication        (AUTHENTICATION) = SERVER
Alternate authentication           (ALTERNATE_AUTH_ENC) = NOT_SPECIFIED
Cataloging allowed without authority   (CATALOG_NOAUTH) = NO
Trust all clients                      (TRUST_ALLCLNTS) = YES
Trusted client authentication          (TRUST_CLNTAUTH) = CLIENT
Bypass federated authentication            (FED_NOAUTH) = NO
__________________
Ritesh Kumar Singh
IBM Certified DB2 DBA for LUW
**Knowledge Is Theft If Not Shared !!**
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On