OLE DB provider "MSDASQL" for linked server Can't connect to MySQL server, connection issue

binrip 0 Reputation points
2024-09-17T05:08:03.9866667+00:00

I have setup SQL Server 2014 linked server to connect to MySQL 8 instance and when I run a single openquery insert statement like below it works fine. However, when I run multiple insert statement to insert data to multiple tables like below openquery insert statement it fails with this generic error majority of the time. If I run this statement at off-peak time sometimes it works without any error.

Errror;

OLE DB provider "MSDASQL" for linked server "LinkedServer" returned message "[MySQL][ODBC 8(w) Driver]Can't connect to MySQL server on 'ip:port' (10060)".

Openquery Insert Statement Used:

INSERT INTO OPENQUERY([server],'SELECT id, name, state_date, created_at, updated_at, created_byFROM `Db1`.table1') SELECT id, name, state_date, created_at, updated_at, created_by FROM source a

I have configured following setting on windows server where i run these queries:

https://learn.microsoft.com/en-us/biztalk/technical-guides/settings-that-can-be-modified-to-improve-network-performance

Also, in mysql side following flags enabled:

max_allowed_packet: 67108864

wait_timeout: 86400

connect_timeout: 28000

net_read_timeout: 3600

interactive_timeout: 28773

net_write_timeout: 3600

bulk_insert_buffer_size: 4294967295

I'm using windows server 2016 VM with SQL Server 2014 Developer Version and Managed MySQL 8 Instance, and ODBC unicode driver 8.4 Need some help, what might be the issue?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,821 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,091 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.