Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2011
    Posts
    9

    Cool Unanswered: 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

  2. #2
    Join Date
    Mar 2011
    Posts
    9
    Have I posted under wrong Tags due to not getting any leads??
    Please specify.

  3. #3
    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?
    Last edited by singhipst; 03-04-11 at 05:01.
    Ritesh Kumar Singh
    IBM Certified DB2 DBA for LUW
    **Knowledge Is Theft If Not Shared !!**

  4. #4
    Join Date
    Mar 2011
    Posts
    9
    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.

  5. #5
    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 !!**

  6. #6
    Join Date
    Mar 2011
    Posts
    9

    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.

  7. #7
    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 !!**

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •