title: Connect to db2 database with Python
body: <p>I'm working on an app that needs to connect to an ibm db2 database. Using DBeaver I can successfully connect to the database (I provide him the <em>db2cc.jar</em> and <em>db2cc4.jar</em> files).</p>
  
  <p>It looks to me as DBeaver is using my Window's credentials to login, because I didn't need to input any login or password to connect.</p>
  
  <p>Now, I've been trying to connect to the same database using python 3.7 and pypi's latest version of the <strong>ibm_db</strong> package. I didn't install anything else.</p>
  
  <pre><code>import ibm_db
  
  # ...
  connection_string = "DATABASE=" + self.params['schema'] + ";" + \
                                           "HOSTNAME=" + self.params['host'] + ";" + \
                                           "PORT=" + self.params['port'] + ";" + \
                                           "PROTOCOL=TCPIP;" + \
                                           "SECURITYMECHANISM=4;" + \
                                           "UID=" + self.params['user'] + ";" + \
                                           "PWD=" + self.params['password'] + ";"
  
  
  try:
      self.connection = ibm_db.connect(connection_string, "", "")
      # ...
  </code></pre>
  
  <p>Using my Windows credentials in the parameters, I get the following error message:</p>
  
  <pre><code>Connection error
  Bad credentials
  SQLCODE=-30082
  08001
  </code></pre>
  
  <p>From what I've seen on stack overflow connecting to a db2 database is complicated... </p>
  
  <p>Does someone know how to connect ? Using the windows credentials or otherwise...</p>
  
  <p>Thanks !</p>