Solved

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
9
573 Views
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','https://creditapplication.xyz.com/?program=Home%20Projects&referral=1234-12&merchant=1234','https://uat-creditapplication.xyz.com/?program=Home%20Projects&referral=1234-12&merchant=123','https://1uat-creditapplication.xyz.com/?program=Home%20Projects&referral=1234-12&merchant=1234')
0
Comment
Question by:jmelcher
  • 4
  • 4
9 Comments
 
LVL 39

Expert Comment

by:lcohan
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.
0
 

Author Comment

by:jmelcher
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?
0
 
LVL 39

Expert Comment

by:lcohan
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.
0
 

Author Comment

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

I get the exact same error.
0
[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

 
LVL 39

Expert Comment

by:lcohan
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','https://creditapplication.xyz.com/?program=Home%20Projects&referral=1234-12&merchant=1234','https://uat-creditapplication.xyz.com/?program=Home%20Projects&referral=1234-12&merchant=123','https://1uat-creditapplication.xyz.com/?program=Home%20Projects&referral=1234-12&merchant=1234'))
0
 
LVL 39

Expert Comment

by:lcohan
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.
0
 

Author Comment

by:jmelcher
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','https://creditapplication.greenskycredit.com/?program=Home%20Projects&referral=1234-12&merchant=1234','https://uat-creditapplication.greenskycredit.com/?program=Home%20Projects&referral=1234-12&merchant=123','https://1uat-creditapplication.greenskycredit.com/?program=Home%20Projects&referral=1234-12&merchant=1234')
0
 
LVL 142

Accepted Solution

by:
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 ...
0
 

Author Closing Comment

by:jmelcher
ID: 37817187
Table is MyIsam
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how the fundamental information of how to create a table.

896 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now