Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB6 application ado connection for TLS1.2

I have to support a VB6 application that is still in production (ugh). A customer is specifying our software needs to be PCI compliant which requires TLS 1.2.

Anyone know how to do this?

I am using SQL Server 2014. I'm patched to build 12.0.4502.0.

Public Function GetConnection() As ADODB.Connection
  Dim con As ADODB.Connection

  On Error Resume Next
  Set con = New ADODB.Connection
  con.ConnectionTimeout = 10

  Dim connstring As String
  'connstring = "Provider=SQLOLEDB;Server=" & gstrServer & ";Database=" & gstrDB & ";User Id=" & gstrUser & ";Password=" & gstrPwd
  connstring = "Provider=MSDASQL;DRIVER=Sql Server;Server=" & gstrServer & ";Database=" & gstrDB & ";UID=" & gstrUser & ";PWD=" & gstrPwd

  con.Open connstring

  If Err Then Set con = Nothing
  Set GetConnection = con
End Function

The project is referencing "Microsoft ADO Ext. 6.0 for DDL and Security" and "Microsoft ActiveX Data Objects 2.5 Library"

I have tried multiple connection string options.

Thanks!

like image 413
FatherOfDiwaffe Avatar asked Mar 31 '17 16:03

FatherOfDiwaffe


1 Answers

I found the answer in Using ADO with SQL Server Native Client.

To enable the usage of SQL Server Native Client, ADO applications will need to implement the following keywords in their connection strings:

Provider=SQLNCLI11

DataTypeCompatibility=80

The following is an example of establishing an ADO connection string that is fully enabled to work with SQL Server Native Client, including the enabling of the MARS feature:

 Dim con As New ADODB.Connection

 con.ConnectionString = "Provider=SQLNCLI11;" _  
         & "Server=(local);" _  
         & "Database=AdventureWorks;" _   
         & "Integrated Security=SSPI;" _  
         & "DataTypeCompatibility=80;" _  
         & "MARS Connection=True;"   
con.Open

Changing the provider to SQLNCLI11 and adding DataTypeCompatibility=80 worked.

like image 107
FatherOfDiwaffe Avatar answered Nov 20 '22 07:11

FatherOfDiwaffe