title: Sql Server 2016: Enable TLS 1.2 for SQL Server Connection
body: <p>I've <code>SQL server 2016</code> running on <code>windows 2012 R2</code> and I applied the patch for TLSv1.2 support and rebooted the VM, <a href="https://support.microsoft.com/en-us/help/3135244/tls-1-2-support-for-microsoft-sql-server" rel="noreferrer">https://support.microsoft.com/en-us/help/3135244/tls-1-2-support-for-microsoft-sql-server</a> I do see TLS 1.2 being enabled using <code>IISCrypto</code> tool on the SQL Server VM</p>
  
  <p>We have Java 8 web application and we've forced the web application to use only TLS1.2 using JVM argument <code>-Djdk.tls.client.protocols="TLSv1.2"</code> (If I remove this JVM argument application connects to sql server fine), but we are seeing below error though <code>TLSv1.2</code> is enabled for SQL server</p>
  
  <pre><code>org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Server chose TLSv1, but that protocol version is not enabled or not supported by the client.". ClientConnectionId:7564b6a1-60c0-4a24-8baa-7bd21f9512cf)  
  </code></pre>
  
  <p>We also have a <code>.Net 2.0</code> windows service (only TLSv1.2 is enabled in registry) which is also failing to connect to <code>SQL Server 2016</code></p>
  
  <pre><code>System.Data.OleDb.OleDbException: [DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security error.
  at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
  at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
  at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
  at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
  at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
  at System.Data.OleDb.OleDbConnection.Open()
  </code></pre>
  
  <p>But if I enable SSL3 and TLS1.0 in the registry, <code>.Net 2.0</code> windows service connects to SQL Server 2016 fine.</p>
  
  <p>I suspect, the issue is SQL Server not using <code>TLSv1.2</code> though <code>TLSv1.2</code> is enabled on the SQL Server VM, Can someone please help me if there anymore config or patches needs to be applied for SQL Server to support <code>TLSv1.2</code> ?</p>