title: Connecting iSeries JDBC to Microsoft Azure SQL Server
body: <p>I have used Scott Klement's example code to create a connection from our iSeries (level V5R2M0) using jtds-1.3.1.jar to our Azure SQL Server. Scott's example RPG ILE program MSSQLTEST gets as far as the connection value test which fails as it is always Null. The Java software successfully loads and shows no errors. The following is the code in question:</p>
  
  <pre><code>prop = JDBC_Properties();
  
  JDBC_setProp(prop: 'userName'     : 'dbadmin@mssqlserver');
  JDBC_setProp(prop: 'password'     : 'password');
  JDBC_setProp(prop: 'databaseName' : 'SQLDatabase');
  JDBC_setProp(prop: 'encrypt'      : 'true');
  JDBC_setProp(prop: 'hostNameInCertificate' : '*.database.windows.net');
  JDBC_setProp(prop: 'loginTimeout' : '30');
  
  conn = JDBC_ConnProp('net.sourceforge.jtds.jdbc.Driver'
  :'jdbc:jtds:sqlserver://mssqlserver.database.windows.net:1433'
  : prop );
  
  JDBC_freeProp(prop);
  
  if (conn = *NULL);
  return;
  endif;
  </code></pre>
  
  <p>The connection parameters were provided by Microsoft as:</p>
  
  <pre><code>jdbc:sqlserver://mssqlserver.database.windows.net:1433;database=Database;user=dbadmin@mssqlserver;password={your_password_here};encrypt=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;
  </code></pre>
  
  <p>I have tried the following to try and make the connection work:</p>
  
  <p>Added a port forward on our router for port 1433 which points to our iSeries IP address</p>
  
  <p>Added our external IP address to our Azure SQL Server firewall</p>
  
  <p>I have tested the connection parameters by creating an ODBC connection to our Azure SQL Server on a PC which works</p>
  
  <p>Does anyone have this working between the iSeries and Azure SQL Server?</p>