What is the proper way to configure a linked server from SQL Server 2008r2 to MySQL that will allow inserts?

Posted on 2012-03-13
Last Modified: 2012-06-21
I have set up the linked server and I can query it and I can update it.  When I try to insert a record I get this message:

OLE DB provider "MSDASQL" for linked server "homeprojectadmin" returned message "[MySQL][ODBC 5.1 Driver][mysqld-5.0.92-log]Commands out of sync; you can't run this command now".
Msg 7343, Level 16, State 2, Line 1
The OLE DB provider "MSDASQL" for linked server "homeprojectadmin" could not INSERT INTO table "[MSDASQL]".

My insert looks like this:
insert INTO OPENQUERY(homeprojectadmin,'select * from home_projects_app_links')
values ('1234','Test Merchant','1234-12','12','','','')
Question by:jmelcher
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
LVL 40

Expert Comment

ID: 37715711
Is it the "Allow Inprocess" property checked or unchecked on the linked server under - Server Objects - Linked Servers - Providers on the MSDASQL? Caution that the setting is for all linked servers on that box so don't just change it.

Author Comment

ID: 37715907
It's the "Allow Inprocess" property.  It was checked and wasn't working; I unchecked it and it still didn't work.  Do I need to re-starts SQL Services when I change that property?
LVL 40

Expert Comment

ID: 37716604
" Do I need to re-starts SQL Services when I change that property?"

I believe that is way deeper tied to the OS (ODBC and all the rest) and it needs a reboot unfortunately. That's what I have to do usually when my box linking SQL to MySQL and Postgress starts to throw errors.
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now


Author Comment

ID: 37720952
I unchecked allow inprocess, rebooted and tried the insert.

I get the exact same error.
LVL 40

Expert Comment

ID: 37721638
I think you should put it back whenever you have a chance if it's not done already and could you please check your insert query as I believe it should be like below:

INSERT INTO OPENQUERY(homeprojectadmin,'select * from home_projects_app_links' values ('1234','Test Merchant','1234-12','12','','',''))
LVL 40

Expert Comment

ID: 37721649
If you can please replace the SELECT * with actual column list and I found sometimes you may need to CAST/CONVERT the VALUES to exactly match the target table column datatype as implicit conversion in drivers not always works well.

Author Comment

ID: 37721795
The syntax you've suggested isn't correct.

I did replace the * with the column list.  Same error.

insert INTO OPENQUERY(homeprojectadmin,'select unique_identifier, merchant_name, promotion_code, plan_code, prod_url, uat_url, test_url from home_projects_app_links')
values ('1234','Melcher Test Merchant','1234-12','12','','','')
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 500 total points
ID: 37753956
is the table InnoDB or MyIsam?
I think it must be InnoDB to be able to work ...

Author Closing Comment

ID: 37817187
Table is MyIsam

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MySQL HA and DR solution. 5 38
Help with Data Warehouse / Data Marts 4 42
semaphore timeout period has expired 1 32
Sql group by orderdate and ordertotal 3 12
Introduction This article is intended for those who are new to PHP error handling (  It addresses one of the most common problems that plague beginning PHP develop…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question