ADODB MYSQL - Can't create TCP/IP socket (10093)

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
715
Office Version
  1. 365
Platform
  1. Windows
Hi,
First i will link my thread i posted on Reddit related to this which i never managed to resolve:
ADODB MYSQL - Can't create TCP/IP socket (10093)
https://www.reddit.com/r/vba/comments/fo6jon
I have some code which inserts data into a database, when i try use the code to insert into both (an access DB and MySQL DB) i get this error. (Can't create TCP/IP socket (10093)

I have tried using CNN for 1 and CNN2 for the other.
I have tried using Access first, and MYSQL first

Note: if i only use 1 or the other it is fine with no problems
as at first i thought was a firewall issue but using only MYSQL works ok

Example code:
VBA Code:
Sub UploadData()
    ADODBInsertACCESS
    ADODBInsertMYSQL
End Sub


Sub ADODBInsertACCESS()

    Set Cnn = New ADODB.Connection
    Cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=xxx;"
                
    I = 2
    
    VBL2 = Sheet1.Cells(I, 2).Value
    VBL3 = Sheet1.Cells(I, 3).Value
    VBL4 = Sheet1.Cells(I, 4).Value
    VBL5 = Sheet1.Cells(I, 5).Value

    MYSQL = "INSERT INTO TABLE1 (COLUMN2,COLUMN3,COLUMN4,COLUMN5) VALUES ('" & VBL2 & "','" & VBL3 & "','" & VBL4 & "','" & VBL5 & "');"
    Cnn.Execute MYSQL
   
    Cnn.Close
    Set Cnn = Nothing

End Sub

Sub ADODBInsertMYSQL()

    Set Cnn = New ADODB.Connection
    Cnn.Open "Driver={MySQL ODBC 5.1 Driver};SERVER=xxx;DATABASE=xxx;UID=xxx;PWD=xxx;PORT=xxx;"
                
    I = 2
    
    VBL2 = Sheet1.Cells(I, 2).Value
    VBL3 = Sheet1.Cells(I, 3).Value
    VBL4 = Sheet1.Cells(I, 4).Value
    VBL5 = Sheet1.Cells(I, 5).Value

    MYSQL = "INSERT INTO TABLE1 (COLUMN2,COLUMN3,COLUMN4,COLUMN5) VALUES ('" & VBL2 & "','" & VBL3 & "','" & VBL4 & "','" & VBL5 & "');"
    Cnn.Execute MYSQL
   
    Cnn.Close
    Set Cnn = Nothing

End Sub

appreciate any help
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
715
Office Version
  1. 365
Platform
  1. Windows
1 bump at the chance someone has a suggestion

Might just have to settle for using 1 or the other
 

Watch MrExcel Video

Forum statistics

Threads
1,118,308
Messages
5,571,463
Members
412,394
Latest member
divster27
Top