title: Create db2 dataSource in WAS liberty profile
body: <p>I am developing for Websphere 8.5 (for z/OS), but i would like to use Liberty for local development on my Windows machine. I can't get the data source to work.</p>
  
  <p>I created the following entry in the Server.xml to define the data source.</p>
  
  <pre><code>&lt;library id="DB2JCC2Lib"&gt;
      &lt;fileset dir="C:\Program Files\IBM\SQLLIB\java"/&gt;&lt;!--includes="db2jcc.jar db2jcc_license_cu.jar db2jcc_license_cisuz.jar"--&gt;
  &lt;/library&gt;
  
  &lt;dataSource id="xxdb" jndiName="jdbc/xxxx" type="javax.sql.ConnectionPoolDataSource"&gt;
      &lt;jdbcDriver libraryRef="DB2JCC2Lib" id="db2-driver" javax.sql.ConnectionPoolDataSource="com.ibm.db2.jcc.DB2ConnectionPoolDataSource"/&gt;
  
      &lt;properties.db2.jcc driverType="2" databaseName="xxxx" portNumber="50000" user="xxxx" password="{aes}xxxx"/&gt;
  &lt;/dataSource&gt;
  </code></pre>
  
  <p>When my application initializes i get the following error message:</p>
  
  <blockquote>
    <p>[jcc][4038][12241][3.61.65] T2LUW exception: SQL30081N  Kommunikationsfehler. Verwendetes Kommunikationsprotokoll: "TCP/IP".  Verwendete Kommunikations-API: "SOCKETS".  Position, an der der Fehler erkannt wurde: "127.0.0.1".  Übertragungsfunktion, die den Fehler festgestellt hat: "connect".  Protokollspezifische(r) Fehlercode(s): "10061", "<em>", "</em>".  SQLSTATE=08001</p>
  </blockquote>
  
  <p>I think this message comes from the db2 Driver, unfortunately i didn't find a way yet to change it to english; but i think it's understandable for english speakers.</p>
  
  <p>I have an ODBC System datasource that connects to DB2 v10 maintenance level 015 for z/OS. My local DB2 Connect Installation is v9.7.300.3885.</p>
  
  <p>In my regular Websphere my working datasource has driver type 2, database Name set to the odbc-name and port number 50000. Server name is not set (empty). Classpath and  implementation class is the same that i provided in the server.xml</p>
  
  <p>I have tried everything i could find, any ideas?</p>
  
  <p>Note: I can't make changes on the db2 server and there is no issue connecting to the database with other tools and the regular WebSphere.
  Also the server name in the websphere configuration is empty, only database name is set. When i tried to set the servername in the server.xml to localhost or the db2 server i got the same result.</p>
  
  <p>Any help is appreciated!</p>
  
  <p>Edit: updated with correct Version Information</p>
  
  <p>Edit 2: As long as it works i dont care what type (2 or 4) of the jdbc driver is used. I just want to point out again that type 2 is currently working on my machine. I tried it with type 4 and got the following message:</p>
  
  <blockquote>
    <p>[jcc][t4][2043][11550][3.61.65] Exception java.net.ConnectException: Error opening socket to server xxx/xxx.30.3.34 on port 50,000 with message: Connection refused: connect. ERRORCODE=-4499, SQLSTATE=08001 DSRA0010E: SQL State = 08001, Error Code = -4,499</p>
  </blockquote>