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
570 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
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

708 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

13 Experts available now in Live!

Get 1:1 Help Now