title: DB2 connection without specifying username and password (.NET)
body: <p>I have installed DB2, and on the same server I'm trying to establish a connection in PowerShell.  It seems, however, that I have to provide the username and password in the connection string in plain text.  As I am trying to create a scheduled task on a secure system, this is not an ideal situation.</p>
  
  <p>I have checked the old standby, <a href="http://connectionstrings.com" rel="nofollow">http://connectionstrings.com</a>, but I cannot find any string that does not explicitly include the username and password.  Is there such a string?  Maybe use a different provider?  Below is the code I'm using.</p>
  
  <pre><code>$cn=new-object System.Data.OleDb.OleDbConnection("Provider=IBMDADB2;Database=TLMA;HostName=xxx;Protocol=TCPIP;Port=50000;Uid=xxx;Pwd=xxx;CurrentSchema=DB2")
  </code></pre>
  
  <p>This is the error I'm getting:</p>
  
  <p>Exception calling "Fill" with "1" arguments(s): " SQL30082N Security processing failed with reason "3" ("PASSWORD MISSING").  SQLSTATE=08001"</p>
  
  <p>I'm open to any idea on how to solve this.</p>
  
  <p><strong>UPDATE:</strong>  I've discovered that the instance has an Authentication setting.  It's currently set to SERVER.  </p>
  
  <p>A connection string that looks like this:</p>
  
  <pre><code>$cn=new-object System.Data.OleDb.OleDbConnection("Provider=IBMDADB2;Database=TLMA;HostName=xxx;Protocol=TCPIP;Port=50000;Authentication=KERBEROS;CurrentSchema=DB2")
  </code></pre>
  
  <p>might work (I'm not sure), but it seems that it would require me to change the Authentication setting to KERBEROS.  I don't know if this will break the application that's currently using the uid/pwd model.</p>