i am trying to update table via OLE DB provider MSDASQL for a linked server.
Connection is working, select statments work without problems. Update also worked until now.
Linked Server: MYSQL DB - update via MYSQL workbench works fine
But now i get the following error:
The OLE DB provider "MSDASQL" for linked server "xxx" could not UPDATE
table "[xxx]...[yyy.zzz]". [SQLSTATE 42000] (Error 7343) OLE DB
provider "MSDASQL" for linked server "xxx" returned message
"[MySQL][ODBC 8.0(w) Driver][mysqld-5.7.38-google-log]You have an
error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '.zzz SET
trn_state=? WHERE check=? AND check_pos=? AND checkopen_time=' at line
1". [SQLSTATE 01000] (Error 7412). The step failed.
My update statement:
update [xxx]...[yyy.zzz]
set trn_state = 1
where trn_state = 0
And yes, it is the first line of the statement - i don't know why the error is referencing things that are not in the statement.
Error message does not match my statement - why ?
Whats the reason ? What am I doing wrong ?
Error in provider options or linked server properties ? Can it be a wrong setting on the other side ?
Related
I am facing issue during delete a record from Link Server.
DELETE
FROM [ABC].[novasystem]..[tbl_missing_lims_ord]
WHERE lims_order_id = '1247552'
Error:
OLE DB provider "MSDASQL" for linked server "ABC" returned message "[MySQL][ODBC 8.0(a) Driver][mysqld-8.0.21]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.tbl_missing_lims_ord WHERE Order_id=? AND collection_date=? AND patient_' at line 1". Msg 7345, Level 16, State 1, Line 1 The OLE DB provider "MSDASQL" for linked server "ABC" could not delete from table "novasystem.tbl_missing_lims_ord`". There was a recoverable, provider-specific error, such as an RPC failure.
I have also used Openquery command but still error.
Delete openquery([ABC],'select * from tbl_missing_lims_ord where lims_order_id=1247552')
OLE DB provider "MSDASQL" for linked server "ABC" returned message "[MySQL][ODBC 8.0(a) Driver][mysqld-8.0.21]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.tbl_missing_lims_ord WHERE Order_id=? AND collection_date=? AND `patient_' at line 1".
Msg 7345, Level 16, State 1, Line 5
The OLE DB provider "MSDASQL" for linked server "ABC" could not delete from table "select * from tbl_missing_lims_ord where lims_order_id=1247552". There was a recoverable, provider-specific error, such as an RPC failure.
I have checked that the RPC and RPC Out are set to TRUE on the LinkedServer’s properties.
Can anyone guide me how I can remove the error?
We have MS SQL Server 2012 and MySQL 5.5, and we need to sync one table data between the two databases. So that whenever a record is inserted in the table "trainee" in MS SQL Server then it should directly copied to the table "trainee" in MySQL database.
We used the linked server, and it works fine for reading data from MySQL with the following driver:
MySQL ODBC 5.2 UNICODE Driver
And then we added a Trigger on the table in MS SQL Server with the following code:
USE [case]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[Inserttms]
ON [case].[dbo].[mdl_tms_trainee]
AFTER INSERT
AS
Insert into dbo.tms (id,u_id,trainee_number) Values ('8','8','888');
Further more, we enable the DTC in the server, set True for RPC and RPC OUT in the LInked Server, and even created aview in the local database in MS SQL Server in order to use workaround, but these all never solve the below problem.
OLE DB provider "MSDASQL" for linked server "TMSCASEU" returned message "[MySQL][ODBC 5.2(w)
Driver]Optional feature not supported".
Msg 7391, Level 16, State 2, Procedure Inserttms, Line 5
The operation could not be performed because OLE DB provider "MSDASQL" for linked server
"TMSCASEU" was unable to begin a distributed transaction.
Error I get when I run
OLE DB provider "MSDASQL" for linked server "WEBSTAGING" returned
message "[MySQL][ODBC 5.3(w) Driver]Optional feature not supported".
Msg 7391, Level 16, State 2, Procedure
trg_DeliveryPartMap_Mysql_Stockupdate, Line 32 The operation could not
be performed because OLE DB provider "MSDASQL" for linked server
"WEBSTAGING" was unable to begin a distributed transaction.
moreover select Query works fine in sql server trigger.
But when I run on Linnked server it works fine
UPDATE OpenQuery(WEBSTAGING, 'SELECT inventory, id, originalId FROM product
WHERE originalId=Xxx') SET inventory = 13
I solved it by calling stored procedure from local server of Linked Server (MySQL Server)
without using OpenQuery I used Exec (Linked server stored procedure)
and it worked
Thanks
I am trying to load data's from MySQL tables to SQL server 2012 tables.
For that i installed "mysql-connector-odbc-5.3.4-win32" driver.
After that importing data using data source " .Net Framework Data Provider For Odbc"
I gave correct connection-string and DSN for Mysql .
At last am getting an error
- Setting Source Connection (Error)
Messages
Error 0xc02020ff: Source - r_cluster [1]: The Source - r_cluster was unable to retrieve column information for the SQL command. The following error occurred: ERROR [42000] [MySQL][ODBC 5.3(a) Driver][mysqld-5.5.25]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"r_cluster"' at line 1
(SQL Server Import and Export Wizard)
Pipeline component has returned HRESULT error code 0xC02020FF from a method call. (Microsoft.SqlServer.DTSPipelineWrap)
Please help me to resolve this issue.
Thanks
I have just looked for the solution to this problem for myself and found the following to work.
In your ODBC Settings (make sure you are using the ANSI driver
Select the details button
In Initial statement at the bottom of the
screen set session sql_mode=ansi_quotes;
MSDN Social - MS server connect to MySQL (ODBC)
I have set up a linked server with the MSDASQL provider in MSSQL to connect to a MySQL instance. I have installed and configured the MySQL ODBC 5.1 Driver connector. Everything seems to work fine to query data from the MySQL instance, but inserting or updating any data is not working. The following command:
INSERT OPENQUERY(MYSQL, 'SELECT id FROM test')
values (1)
intended on inserting a simple value of 1 returns the error:
OLE DB provider "MSDASQL" for linked server "MYSQL" returned message "[MySQL][ODBC 5.1 Driver][mysqld-5.5.21]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 "MYSQL" could not INSERT INTO table "[MSDASQL]".
I have also attempted to open an editable results pane for the MySql test table and insert data that way, I receive the following error:
The operation could not be performed because OLE DB provider "MSDASQL" for linked server "MYSQL" was unable to begin a distributed transaction.
OLE DB provider "MSDASQL" for linked server "MYSQL" returned message "[MySQL][ODBC 5.1 Driver]Optional feature not supported".
Does anyone have some insight or experience on how to solve this problem?