title: Java - DB2 Connection Error SQL30082N "USERNAME AND/OR PASSWORD INVALID"
body: <p>I'm trying to connect to a remote IBM DB2 9.7 database from a java application.
  The connect fails with the following error:</p>
  
  <blockquote>
    <p>SQL30082N  Security processing failed with reason "24" ("USERNAME
    AND/OR PASSWORD INVALID").  SQLSTATE=08001</p>
  </blockquote>
  
  <p>This says that there's something wrong with the username and password. 
  However, I am quite sure that I used the correct username and the correct password.</p>
  
  <p>I've already tried the following things in order to solve this problem:</p>
  
  <ul>
  <li>I'm on HP-UX and the user account for db2 is called "db2inst1". This should work according to the naming rules I found.</li>
  <li>SSH connect to the machine with exactly the same username and password works fine.</li>
  <li>Once logged in over SSH as user db2inst1, "db2 connect to SAMPLE" works. 
  However, "db2 connect to SAMPLE user db2inst1" produces the error above, even with the correct password.</li>
  <li>Through google I found that "Database manager authentication" in the dbm cfg has to be set to SERVER. It was already set to SERVER all this time.</li>
  <li>"db2 get dbm cfg | grep -i auth" produces this result:</li>
  </ul>
  
  <blockquote>
  <pre><code> GSS Plugin for Local Authorization    (LOCAL_GSSPLUGIN) = 
   Server Connection Authentication          (SRVCON_AUTH) = SERVER   
   Database manager authentication        (AUTHENTICATION) = SERVER   
   Alternate authentication           (ALTERNATE_AUTH_ENC) = NOT_SPECIFIED 
   Cataloging allowed without authority   (CATALOG_NOAUTH) = NO   
   Trusted client authentication          (TRUST_CLNTAUTH) = CLIENT   
   Bypass federated authentication            (FED_NOAUTH) = NO
  </code></pre>
  </blockquote>
  
  <p>Edit: The problem still isn't solved, but I have found out more about it:</p>
  
  <p>Db2diag contains the following warnings:</p>
  
  <blockquote>
    <p>2012-07-20-06.18.24.445983-360 I122110A443        LEVEL: Warning PID<br>
    : 24470                TID  : 223         PROC : db2sysc 0 INSTANCE:
    db2inst1             NODE : 000         DB   : SAMPLE APPHDL  :
    0-25775 EDUID   : 223                  EDUNAME: db2agent (SAMPLE) 0
    FUNCTION: DB2 UDB, bsu security, sqlexLogPluginMessage, probe:20 DATA
    1 : String with size, 67 bytes Password validation for user db2inst1 failed with rc = -2146500507</p>
    
    <p>2012-07-20-06.18.24.446251-360 I122554A436        LEVEL: Warning PID<br>
    : 24470                TID  : 223         PROC : db2sysc 0 INSTANCE:
    db2inst1             NODE : 000         DB   : SAMPLE APPHDL  :
    0-25775 EDUID   : 223                  EDUNAME: db2agent (SAMPLE) 0
    FUNCTION: DB2 UDB, bsu security, sqlexSlsSystemAuthenticate, probe:150
    MESSAGE : application id: DATA #1 : String with size, 26 bytes
    C0A8150A.D350.120720121824</p>
  </blockquote>
  
  <p>Also, some queries to the SYSPROC generate the error as well. For example this one:</p>
  
  <blockquote>
    <p>db2 "values SYSPROC.AUTH_GET_INSTANCE_AUTHID()"</p>
  </blockquote>
  
  <p>I am now guessing it has to do with the access rights.
  I can see some rights by using the query </p>
  
  <blockquote>
    <p>"SELECT * FROM TABLE (SYSPROC.AUTH_LIST_AUTHORITIES_FOR_AUTHID
    ('db2inst1', 'U') ) AS T ORDER BY AUTHORITY"</p>
  </blockquote>
  
  <p>The result of this is, CONNECT is on "N" for D_USER, but on "Y" for D_GROUP.</p>
  
  <p>I'm guessing D_USER should be on "Y", so that db2inst1 is allowed to connect.
  Therefore, I've tried to grant the rights for this by using </p>
  
  <blockquote>
    <p>db2 “GRANT CONNECT ON DATABASE TO USER db2inst1”</p>
  </blockquote>
  
  <p>but no luck, D_USER is still on "N", and the error still occurs.</p>
  
  <p>Any more ideas what I can do?</p>
  
  <p>I'd very much appreciate help on this issue!</p>