Il est nécessaire modifier la chaîne de connexion pour utiliser le pilote MSOLEDBSQL au lieu de SQLOLEDB. Exemple de chaîne compatible : Provider=MSOLEDBSQL;Server=NomServeur;Database=NomBase;UID=User;PWD=Password;Encrypt=yes
Exemple en langage C# :
using System;
using System.Data.OleDb;
class Program
{
static void Main()
{
// Utilisation de SQLOLEDB (ne supporte pas TLS 1.2) :
// Erreur : Login failed due to client TLS version being less than minimal TLS version allowed by the server.
// string connectionString = @"Provider=SQLOLEDB;Server=mlypy8bjsq.database.windows.net;Database=zmplukdtw2_I9AG1BEQTE;UID=zmplukdtw5_TEST;PWD=1234;Encrypt=yes;";
// Utilisation de MSOLEDBSQL pour supporter TLS 1.2 :
string connectionString = @"Provider=MSOLEDBSQL;Server=mlypy8bjsq.database.windows.net;Database=zmplukdtw2_I9AG1BEQTE;UID=zmplukdtw5_TEST;PWD=1234;Encrypt=yes;";
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
try
{
connection.Open();
Console.WriteLine("Connexion réussie !");
}
catch (Exception ex)
{
Console.WriteLine("Erreur de connexion : " + ex.Message);
}
}
}
} REMARQUE : Si nécessaire, télécharger le pilote Microsoft OLE DB Driver pour SQL Server (MSOLEDBSQL) : go.microsoft.com/fwlink/?linkid=2278907 Source Microsoft : Faq sur les changements de mise hors service TLS 1.0 et 1.1 à venir |