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
580 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

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

I get the exact same error.
0
 
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 143

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Powershell v3 - SQLCMD 3 27
Acces SQL Insert Problem 6 32
In sql, how to roll up multiple rows to only one row. 4 38
SQL Recursion 6 20
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

828 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